HTML and CSS Reference
In-Depth Information
Note
the JSF (implicit and rule-based) navigation can be performed using
1. <h:commandButton> and <h:commandLink> via the action attribute.
2. <h:button> and <h:link> via the outcome attribute.
Both the action and the outcome attributes can accept a String literal or an eL expression, which refers to a method
that returns a String (in the case of the action attribute) or an eL expression that evaluates to a String (in the case of the
outcome attribute).
The <from-view-id> element can also be omitted, as shown in Listing 2-31.
Listing 2-31. Rule-Based Navigation Example 3
<navigation-rule>
<navigation-case>
<from-outcome>success</from-outcome>
<to-view-id>/welcome.xhtml</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>fail</from-outcome>
<to-view-id>/invalid.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
When the <from-view-id> element is omitted, this means that the navigation cases will be available for all
the pages of the application which means that for Listing 2-31, when the return result of the action or outcome
attributes of the components in any page is matched with the <from-outcome> value, the corresponding navigation
case will fire.
It is important to know that the navigation cases are executed in the order of their presence inside the
<navigation-rule> .
Note
One of the nice features of the JSF navigation is the support of the wildcards in the <from-view-id> element. This
can be useful if you want to apply a navigation rule on a set of pages in the JSF application. Listing 2-32 shows an example.
Listing 2-32. Rule-Based Navigation Example 4
<navigation-rule>
<from-view-id>/common/*</from-view-id>
<navigation-case>
<from-outcome>success</from-outcome>
<to-view-id>/welcome.xhtml</to-view-id>
</navigation-case>
 
Search WWH ::




Custom Search