In old jsf the following code worked
<navigation-rule>
<from-view-id>/page1.xhtml</from-view-id>
<navigation-case>
<from-outcome>true</from-outcome>
<to-view-id>/page2.xhtml</to-view-id>
<redirect>
<view-param>
<name>id</name>
<value>#{myBean.id}</value>
</view-param>
</redirect>
</navigation-case>
</navigation-rule>
page1.xhtml code:
<f:metadata>
<f:viewParam id="id" name="id" value="#{myBean.id}" />
<f:viewAction action="#{myBean.init()}"/>
</f:metadata>
Java Code:
public class MyBean(){
private double id;
public boolean init(){
if(id > 0)
return true;
else
return false;
}
}
In the success scenario, when page1.xhtml?id=0page1 will be open, while page1.xhtml?id=1navigation to page2with the parameter id=1.
navigation in page2.xhtml?id=1with the parameter is necessary, because in the page2on parameter it is PostConstructeither <f:viewAction>read and it is required to find the object in accordance with this id
Using jsf 2.2 with implementation mojarra javax.faces-2.2.8 in the faces-config.xml file is not <view-param>there <redirect-param>, the change should not result in a successful scenario, when navigation without id, where it will be moved page2.xhtmlinsteadpage2.xhtml?id=1