Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Passing parameters between different JSF pages

843844Apr 18 2008 — edited Apr 22 2008
I have the following problem. I have the jsf page from where I would like to call another jsf page and pass the parameter. This is the code sample of the caller (tokenList.jsf) page:

<h:commandLink action="#{tokenList.viewTokenLog}" immediate="true">
<h:outputText value="View Log"></h:outputText>
<f:setPropertyActionListener target="#{tokenLog.uscn}" value="#{record.uscn}" />
</h:commandLink>

As you can see I call a method tokenList.viewTokenLog that returns a string for the navigation rule (that loads tokenLog.jsf) and does nothing else. However i also set the property of the tokenLog (I guess the managed bean tokenLog must be created at that time as well). I don't know if I can do like that, but whatever.

The navigation rule loads the tokenLog.jsf where I have the following method in the tokenLog managed bean:

@PostConstruct
public String filterNew(){

this.currentPage = 0;

this.numRecords = managmentBean.getNumLogsByCriteria1(this.sortField, this.sortOrder, this.uscn);
this.numPages = (Integer)(this.numRecords / (ROWCOUNT + 1));

this.filter();

return null;
}

So as you can see the this.uscn field (that must be set by now) is used in the query. I use the @PostConstruct notation since the managmentBean instance is the EJB injection (and EJB initialization is performed at the end of the construction of the managed bean).

The problem is that at that time (of the first load of tokenLog.jsf) the this.uscn is null. I don't know why is that, since the method must be invoked at the end of the construction phase. However the jsf line:

<h:outputText value="uscn = #{tokenLog.uscn}"></h:outputText>

outputs the correct value (but the this.uscn in the filterNew() method is null). I don't really understand how is that possible and what can I do to fix it.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 20 2008
Added on Apr 18 2008
10 comments
518 views