I've been using JSF 2.1 with mojarra-2.1.20
, and I've configured in my faces-config.xml
a navigation case like this:
<navigation-rule>
<from-view-id>/loggedOut.xhtml</from-view-id>
<navigation-case>
<from-action>#{sessionManager.isLoggedIn}</from-action>
<from-outcome>true</from-outcome>
<to-view-id>/login.xhtml</to-view-id>
<redirect />
</navigation-case>
</navigation-rule>
The action is executed using seam-faces viewAction
(similiar to JSF 2.2 new tag). All has been working fine.
Today I've upgraded to JSF 2.2 with mojarra-2.2.6
, and browsing to the view loggedOut.xhtml
stoped working. It throws this stacktrace:
java.lang.NullPointerException
at com.sun.faces.application.NavigationHandlerImpl.determineViewFromActionOutcome(NavigationHandlerImpl.java:1342)
at com.sun.faces.application.NavigationHandlerImpl.findExactMatch(NavigationHandlerImpl.java:603)
at com.sun.faces.application.NavigationHandlerImpl.getViewId(NavigationHandlerImpl.java:481)
at com.sun.faces.application.NavigationHandlerImpl.getNavigationCase(NavigationHandlerImpl.java:149)
at com.sun.faces.application.NavigationHandlerImpl.getNavigationCase(NavigationHandlerImpl.java:140)
at org.jboss.seam.faces.event.SeamPreNavigationHandler.getNavigationCase(SeamPreNavigationHandler.java:42)
at org.jboss.seam.faces.event.SeamPreNavigationHandler.handleNavigation(SeamPreNavigationHandler.java:57)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:132)
at org.jboss.seam.faces.component.UIViewAction.broadcast(UIViewAction.java:381)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:790)
at javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java:931)
at com.sun.faces.lifecycle.ApplyRequestValuesPhase.execute(ApplyRequestValuesPhase.java:78)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:646)
...
I have more navigations like this, and all of them fail in the same way. The only difference between this navigations and other cases and examples is that from-outcome
value is a boolean
and not a String
. So my questions are:
- Should
from-outcome
's fail when it is not aString
?- If so, should not fail with a more "readable" message?
- Else, is a
mojara
bug?
- Version 2.1 was wrong then?
I know how to "fix it": using a {dummyAction.execute}
and checking the boolean in the <if>
tag. But I prefered to execute the real action and not 2 differents.