I'm looking for a good explanation to JSF 2.0 implicit navigation and how it works with views. To be more precise, I understand that from an action method I can return a string which is the outcome of the action. If there's a JSF view whose file name matches the outcome, then this is implicit navigation.
Now... my question, what if the action is invoked from a view that's inside a folder but the v开发者_StackOverflowiew that I want to navigate to next is in a different folder? I.e., from /manager/edit.xhtml
an action is invoked. What String should that action return so that navigation can safely go to /user/list.xhtml
or to /index.xhtml
or to /manager/index.xhtml
?
As far as my knowledge goes, JSF looks for a matching view only within the current context. You probably have to define a navigation rule in your faces-config.xml to handle an outcome in a special way. Here is an example:
<navigation-rule>
<from-view-id>/profiles/viewkeypages.xhtml</from-view-id>
<navigation-case>
<from-outcome>editkeypage</from-outcome>
<to-view-id>/users/editkeypage.xhtml</to-view-id>
<redirect />
</navigation-case>
</navigation-rule>
-Praveen.
You can use implicit navigation to get to views in other folders.
Just do something like this in a view:
<h:link value="Move" outcome="#{request.contextPath}/users/editkeypage.xhtml?faces-redirect=true" />
or
<h:link value="Move" outcome="/users/editkeypage.xhtml?faces-redirect=true" />
精彩评论