Dynamic Navigation - Forcing navigation from code

There are a number of questions on this forum about this, but all of them end with this as a solution for dynamically using the JSF navigation:

NavigationHandler navigator = getApplication().getNavigationHandler();

navigator.handleNavigation( getFacesContext(), null,"next_page" );

However, this doesn't work for me at all. I'm trying to call this in prerender(), are there limitations about when you can call this? I'm being forced to do this:

FacesContext.getCurrentInstance().getExternalContext().redirect ("next_page.jsp" );

Which feels like a total hack, since it's not utilizing the JSF Navigation. I would like to stay within the standard so all of my navigation rules are in the same place. How can I do this? Thanks.

[818 byte] By [pennstump] at [2007-11-26 11:13:55]
# 1
When you are navigating to another page, prerender() method is not invocated, i.e. in the case of action handlers that return a not null String. If you intend to manually manipulate the navigationHandler, then prerender() is not the best place to use it.Best regardsAntonio.
antoniovl at 2007-7-7 3:28:30 > top of Java-index,Development Tools,Java Tools...
# 2

Where is it appropriate to use then? Init? Preprocess? Constructor?

I tried all of the other messages; I just can't get Studio Creator 2 to do anything with this code:

NavigationHandler navigator = getApplication().getNavigationHandler();

navigator.handleNavigation( getFacesContext(), null, "next_page" );

Thanks for your help.

pennstump at 2007-7-7 3:28:30 > top of Java-index,Development Tools,Java Tools...
# 3
Can anyone from the Creator team help here?
pennstump at 2007-7-7 3:28:30 > top of Java-index,Development Tools,Java Tools...
# 4

From my experience, this (being the redirect page, not using JSF navigation) is the only way I could get it to work. Since I am developing portlets, which by standard ignores page redirects, this has left me with no usable dynamic navigation.

Your other option pennstump would be to write your own stage handlers so you could "extend" the jsf invocation model and add another action stage to handle your redirect. That seems to be the only valid way I have found that would allow JSF navigation techniques to be used without an action event being processed.

jbjonesjr at 2007-7-7 3:28:30 > top of Java-index,Development Tools,Java Tools...
# 5
Thank you for the insight. Anyone else know anything about this topic?
pennstump at 2007-7-7 3:28:30 > top of Java-index,Development Tools,Java Tools...
# 6
Have you tried this? http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/2/dyn pagenav.htmlLet me know, how what you are doing is different from what done in above. ThanksK
kish@sun at 2007-7-7 3:28:30 > top of Java-index,Development Tools,Java Tools...