amorfis
amorfis

Reputation: 15770

Navigation not working

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 debug to check what is wrong? There are no error messages while initialization etc.

Upvotes: 0

Views: 2117

Answers (2)

BalusC
BalusC

Reputation: 1108557

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.

Upvotes: 1

rubberduck
rubberduck

Reputation: 11

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.

Upvotes: 1

Related Questions