Static Navigation

In the previous example, action outcomes are returned by an action method.  The value is compared to from-
outcomes in faces-config.xml. This form of navigation is know as dynamic navigation because the outcome is
based on some sort of decision and is dynamically generated. The navigation to another page may not require
any decision making. For example, if the user clicks on a Help link, JSF can take them directly to help
without the need to call on an action method. This form of navigation is called static navigation.

In a button or link, simply provide a static action attribute instead of a method reference.


<h:commandButton label=”Help” action=”help”/>


The value in the action attribute must match an outcome in the navigation rules in the faces-config.xml.

Static  navigation rule for login.jsp.


 <navigation-rule>
     <description>
         Help from login page
     </description>
     <from-view-id>/login.jsp</from-view-id>
     <navigation-case>
         <from-outcome>help</from-outcome>
         <to-view-id>/help.jsp</to-view-id>
     </navigation-case>
 </navigation-rule>


Since each page may have a “help” link on it, you might imagine your configuration file could get quite
repetitive. You can group multiple navigation rules together.

Help from any page.

 <navigation-rule>
     <description>
         Help from any page
     </description>
     <navigation-case>
         <from-outcome>help</from-outcome>
         <to-view-id>/help.jsp</to-view-id>
     </navigation-case>
 </navigation-rule>


In his example, simply dropping the from-view-id from the navigation rule and now any button or link push
with a “help” action goes to the help page.
Static Navigation
Table of Contents
Copyright (c) 2008.  Intertech, Inc. All Rights Reserved.  This information is to be used exclusively as an
online learning aid.  Any copying is strictly prohibited.
Courseware
Training Resources
Tutorials
Services