MyFaces 2.1 redirect navigation case
I just switch from Mojarra to Myfaces. Mostly not too much of a hassle but for the navigation rules not working as before. I'm have problems with redirect in the navigation case:
<navigation-case>
<from-outcome>test.edit</from-outcome>
<to-view-id>/test.xhtml</to-view-id>
<redirect/>
</navigation-case>
Any command link navigation such as below will result in a 403 error (access denied) :
<h:commandLink value="Add" id="test" action="test.edit"/>
In this particular case the browser has attempted to redirect to test.xhtml (not 开发者_开发问答test.jsf). This is prevented by the security constraints in web.xml. Of course if you remove the security constraints you serve the raw xhtml.
If I remove the redirect it works just fine, but of course does not change the browser Url.
Also I used to be able to do navigation on void outcomes like:
<navigation-rule>
<from-view-id>/test.xhtml</from-view-id>
<navigation-case>
<from-action>#{bean.save}</from-action>
<if>#{true}</if>
<to-view-id>/list.xhtml</to-view-id>
<redirect/>
</navigation-case>
</navigation-rule>
However when an ajax request is sent to dynamically show a list (not calling the bean.save method) then the page is redirected.
If you have problems when moving from Mojarra to MyFaces, the best bet is send a mail to MyFaces users mailing list, so if there is a bug there are better chances to get it solved. Try the latest version (at JUN 2011 is 2.0.7 / 2.1.1). See MyFaces Mailing Lists
The first one seems to be a bug, but more info related to your web.xml config is required. The second one is expected.
If it is a bug, you can file an issue here MyFaces Issue Tracker
精彩评论