JSF navigation rule not working on menu
My commandlink on menu.xhtml did not work. I have my menu.xhtml in template folder under WebContent and list.xhtml in pages folder under WebContent as well. When i click on the link in my menu.xhtml it did not go to list.xhtml page but it did reach the method being called.
menu.xhtml
<h:commandLink action="#{UserManagerBean.goListPage}">
<h:outputText value="List"/>
</h:commandLink>
faces-config.xml
<navigation-rule>
<display-name>template/menu.xhtml</display-name>
<from-view-id>/template/menu.xhtm开发者_运维知识库l</from-view-id>
<navigation-case>
<from-action>#{UserManagerBean.goListPage}</from-action>
<from-outcome>success</from-outcome>
<to-view-id>/pages/list.xhtml</to-view-id>
<redirect />
</navigation-case>
</navigation-rule>
Please help me, thank you.
It seems the problem with
<from-view-id>/template/menu.xhtml</from-view-id>
I think you are including this menu in some page as a part of template.
Try just changing
<from-view-id>/pages/*</from-view-id>
but here you must be sure that your #{UserManagerBean.goListPage}
is not being called by any other pages from /pages/
or handle accordingly.
精彩评论