Why is NavigationHandler.handleNavigation() not forwarding to view ID?

Posted by Erik Hermansen on Stack Overflow See other posts from Stack Overflow or by Erik Hermansen
Published on 2010-04-02T21:59:20Z Indexed on 2010/04/02 22:03 UTC
Read the original article Hit count: 293

Filed under:

Inside of a phase listener class that runs during the "RESTORE_VIEW" phase, I have some code like this:

public void afterPhase(PhaseEvent event) {
  FacesContext fc = event.getFacesContext();
  NavigationHandler nh = fc.getApplication().getNavigationHandler();
  nh.handleNavigation(fc, null, "/a/specific/path/to/a/resource.jspx");
}

Navigation to the new URL doesn't work here. The request made will just receive a response from the original JSPX that was navigated to.

Code like this works fine:

public void afterPhase(PhaseEvent event) {
  FacesContext fc = event.getFacesContext();
  NavigationHandler nh = fc.getApplication().getNavigationHandler();
  nh.handleNavigation(fc, null, "OUTCOME_DEFINED_IN_FACES_CONFIG_XML");
}

Also the first snippet will work with an IceFaces Faces provider, but not Sun JSF 1.2 which is what I need to use. Is there something I can do to fix the code so it is possible to forward to specific URLs?

© Stack Overflow or respective owner

Related posts about jsf