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);
}
6
  • 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 stackoverflow.com/a/18044894/785663 and the linked answer. Commented Sep 17, 2014 at 7: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. Commented Sep 18, 2014 at 5:42
  • Can you please edit your post to show how this redirect from the security page to your URL is done? Commented Sep 18, 2014 at 8: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 Commented Sep 22, 2014 at 8: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. Commented Sep 22, 2014 at 11:27

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.