Previous Section  < Day Day Up >  Next Section

<navigation-rule>

The <navigation-rule> element declares a navigation rule for the default navigation handler.

Syntax

<navigation-rule>

  [<description [xml:lang="lang"]>description</description>]*

  [<display-name [xml:lang="lang"]>displayName</display-name>]*

  [<icon [xml:lang="lang"]>

     [<small-icon>iconPath</small-icon>]

     [<large-icon>iconPath</large-icon>]

   </icon>]*

  [<from-view-id>viewId</from-view-id>]

  [<navigation-case>

    [<description [xml:lang="lang"]>description</description>]*

    [<display-name [xml:lang="lang"]>displayName</display-name>]*

    [<icon [xml:lang="lang"]>

       [<small-icon>iconPath</small-icon>]

       [<large-icon>iconPath</large-icon>]

     </icon>]*

    [<from-action>actionBinding</from-action>]

    [<from-outcome>outcome</from-outcome>]

    <to-view-id>viewId</to-view-id>

    [<redirect/>]

   </navigation-case>]*

</navigation-rule>

The optional <from-view-id> element limits the rule to the specified view ID or all views with IDs matching a pattern, for instance "/myViews/*", where the asterisk matches any characters. One or more <navigation-case> elements declares which view to select (the <to-view-id> element) depending on the action method (the <from-action> element) and/or the action method's outcome (the <from-outcome> element):

<navigation-rule>

  <from-view-id>/myView.jsp</from-view-id>

  <navigation-case>

    <from-action>#{myBean.myActionMethod}</from-action>

    <from-outcome>success</from-outcome>

     <to-view-id>/myOtherView.jsp</to-view-id>

  </navigation-case>

</navigation-rule>

<navigation-rule>

  <from-view-id>/*</from-view-id>

  <navigation-case>

    <from-outcome>error</from-outcome>

     <to-view-id>/myErrorView.jsp</to-view-id>

     <redirect/>

  </navigation-case>

</navigation-rule>

Omitting the <from-action> or the <from-outcome> element means that the view is selected regardless of which action produced the outcome or which outcome was produced, respectively. If the <redirect> element is included, the new view is requested through a redirect response.

    Previous Section  < Day Day Up >  Next Section