• Post Reply Bookmark Topic Watch Topic
  • New Topic

JSF 1.2 IllegalState Exception from backing bean redirect to external site

 
Brian Berry
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Brian Berry
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am so used to using the navigation rule feature of JSF that I completely overlooked the fact that a return value is unnecessary if not going to use navigation rules!

The simple fix was for me to have the commandButton action set to a method that had no return value and was not tied to any navigation rules.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!