0

I am accessing my jsf page using <f:viewParam> and <f:viewAction>

My page is accessing fine where parameter is read from url and getter and setter are accessed

My problem is that when this page session is lost and i refresh the page to rerun i will be directed to a login page and username and password are written and then redirected to my page but <f:viewParam> is not reading the url

I debuged my code it is not accessing the getter and setter of the variable where the variable stays 0 instead of being set to the id in the url

URL: localhost:8080/myProject/views/myPages/bookList?id=1

JSF code:

<f:viewParam name="id" value="#{bean.id}"/>
<f:viewAction value="#{bean.init()}" onPostback="false"/>

Java code:

private BookList bookList;

@EJB
BookFacade bookFacade;

private String id;

public String getId(){
   return id;
}

public void setId(String id){
   this.id=id;
}

public void init(){
   //good scenario id is sent 1 while session is lost id is sent 0
   bookList = bookFacade.find(id);
}
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
bob-cac
  • 1,272
  • 2
  • 17
  • 35
  • When you say "redirected to my page", how's that happening? My *guess* right now is that your redirect loses the url parameter. Probably see http://stackoverflow.com/a/18044894/785663 and the linked answer. – mabi Sep 17 '14 at 07:59
  • no my redirect does not looses the url parameter. I read the link i used in same way but i think the problem is that there is a security login page which ask for login before redirection. – bob-cac Sep 18 '14 at 05:42
  • Can you please edit your post to show how this redirect from the security page to your URL is done? – mabi Sep 18 '14 at 08:26
  • What you want me to add the xml code for the security reditect or the url or what.. Its simply on session timeout refresh to page or any button click causes my page to redirect to the login page and after login redirect to my page where url is not loosing parameter – bob-cac Sep 22 '14 at 08:07
  • Yeah, I basically wanted to confirm that there's a new GET request for your page. "Redirect" means a lot of things in different contexts. If it's a complete HTTP redirect there shouldn't be any difference between the two cases. – mabi Sep 22 '14 at 11:27
  • when page redirects to login page after loosing session the url remains the same without changing to the url of login page... what i mean redirecting to login page then to requestd page url is not changing its always the same – bob-cac Sep 22 '14 at 11:55

0 Answers0