开发者

Navigation not working

开发者 https://www.devze.com 2023-03-16 19:44 出处:网络
I have simple JSF application. Everything works fine, but not navigation. It behaves like <navigation-rule>s were not there. In my faces-config.xml I have some navigation rules like:

I have simple JSF application. Everything works fine, but not navigation. It behaves like <navigation-rule>s were not there. In my faces-config.xml I have some navigation rules like:

<navigation-rule>
  <from-view-id>/view/party/create/create.xhtml</from-view-id>
  <navigation-case>
    <from-outcome>edit</from-outcome>
    <if>#{partyCreate.partyTypeSearch.code == partyTypeDao.organisation.code}</if>
    <to-view-id>/view/party/create/edit-organisation.xhtml</to-view-id>
    <redirect />
  </navigation-case>
</navigation-rule>

But when I click button on create.xhtml page, I get the message:

Unable to find matching navigation case with from-view-id '/view/party/create/create.xhtml' for action '#{partyCreate.displayParty}' with outcome 'edit'

What can be causing it? I have second application where settings are pretty the same, and there navigation works fine. How can I 开发者_JS百科debug to check what is wrong? There are no error messages while initialization etc.


The declaration looks fine. Perhaps the <if> condition simply points to wrong property names or returned unexpected property values. To test the one and other, just remove the <if> declaration or run a debugger. If in vain, then try to remove the <from-view-id> (so that any view source is valid) to exclude it from being the cause.


You can debug it by looking at NavigationHandler.handleNavigation method (if is not overridden, in: javax.faces.application.NavigationHandler). Within that method you can see what is the next action. In my opinion I think you should leave the logic - i.e. <if /> - in the Controller which manage that flow.

0

精彩评论

暂无评论...
验证码 换一张
取 消