Wednesday, 7 November 2012

How to define navigation rule in JSF  faces-config.xml?

<navigation-rule>
 <from-view-id>welcome.xhtml</from-view-id>
 <navigation-case>
  <from-outcome>success</from-outcome>
  <to-view-id>page1.xhtml</to-view-id>
 </navigation-case> 
        <navigation-case>
  <from-outcome>failure</from-outcome>
  <to-view-id>page2.xhtml</to-view-id>
 </navigation-case>  
 </navigation-rule>
 
 
 
In JSF 2, we can also put conditional checking like .....
 
<navigation-rule>
 <from-view-id>welcome.xhtml</from-view-id>
 <navigation-case>
  <from-outcome>success</from-outcome>
                <if>#{testBean.count &gt 0}</if>
  <to-view-id>page1.xhtml</to-view-id>
 </navigation-case>          
         <navigation-case>
  <from-outcome>failure</from-outcome>
  <to-view-id>page2.xhtml</to-view-id>
 </navigation-case>  
 </navigation-rule>  

 

No comments:

Post a Comment