<navigation-rule>
<from-view-id>/pages/index.jsp</from-view-id>
<navigation-case>
<from-outcome>success</from-outcome>
<to-view-id>/pages/welcome.jsp</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>failure</from-outcome>
<to-view-id>/pages/index.jsp</to-view-id>
</navigation-case>
</navigation-rule>
The value of "from-outcome" should be consistent with the return value of any control method.
public String actionMethod(){
...
return "success"
}
Or the value of action in jsf tag like CommandButton or CommandLink.
<h:commandButton action="success" value="Go to success page" immediate="true"/>
Sample 2
<navigation-rule>This navigation rule need
<from-view-id>/pages/index.jsp</from-view-id>
<navigation-case>
<from-action>#{user.verify}</from-action>
<from-outcome>success</from-outcome>
<to-view-id>/pages/welcome.jsp</to-view-id>
</navigation-case>
....
</navigation-rule>
- the method "user.verify()" was triggered.
- the return value of "user.verify()" was "success".
Then it would navigate to page "/pages/welcome.jsp"
Sample 3
<navigation-rule>The navigation rule will be applied to those requests coming from "/pages/index.jsp"
<from-view-id>/pages/index.jsp</from-view-id>
<navigation-case>
<from-outcome>success</from-outcome>
<to-view-id>/pages/welcome.jsp</to-view-id>
<redirect/>
</navigation-case>
....
</navigation-rule>
Wildcard is allowed here.
<navigation-rule>
<from-view-id>/admin/*</from-view-id>
<navigation-case>
<from-action>#{user.verify}</from-action>
<from-outcome>success</from-outcome>
<to-view-id>/pages/welcome.jsp</to-view-id>
</navigation-case>
....
</navigation-rule>
No comments:
Post a Comment