• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JSF 1.2 IllegalState Exception from backing bean redirect to external site

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
WHAT is your favorite color? Blue, no yellow, ahhhhhhh! Tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic