I am using a command button to post a form to backing bean method. At the end of that method I am attempting to redirect to an external site after setting various options in the response. I get an IllegalState Exception because of the redirect.
at com.ibm.ws.webcontainer.webapp.WebAppDispatcherContext.sendRedirectWithStatusCode(WebAppDispatcherContext.java:571)
at com.ibm.ws.webcontainer.webapp.WebAppDispatcherContext.sendRedirect(WebAppDispatcherContext.java:528)
at com.ibm.ws.webcontainer.srt.SRTServletResponse.sendRedirect(SRTServletResponse.java:1234)
at com.sun.faces.context.ExternalContextImpl.redirect(ExternalContextImpl.java:426)
at com.sun.faces.application.NavigationHandlerImpl.handleNavigation(NavigationHandlerImpl.java:181)
here is the problem code from the backing bean method:
I realize that the return statement is unnecessary and should not be reached, but in the case of this redirectPage getting populated this is required functionality. I can't use navigation rules to setup a dynamic external site redirect, right? What can I do?
looking closer at the exception, it seems the navigation handler is causing the problem. Apparently
JSF does not like me jumping out a method called by a commandButton, any ideas how to work around this?