bob-cac
bob-cac

Reputation: 1302

f:viewParam not reading url on session lost

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);
}

Upvotes: 0

Views: 174

Answers (0)

Related Questions