It's not a secret anymore!
The moose likes Struts and the fly likes IllegalStateException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "IllegalStateException" Watch "IllegalStateException" New topic


Masha Klimenko
Ranch Hand

Joined: Feb 04, 2004
Posts: 31
I am very puzzled by this:
After the struts action completes and forward is returned a few more calls are made by struts to complete the response, however an IllegalStateException is thrown in org.apache.catalina.core.ApplicationDispatcher.doForward(...) method with the usual message: Cannot forward after response has been commited. Then control returns back to my action which at that point completes successfully, and the result from jsp page is returned.
Any ideas would be appritiated. Thanks.

Mark Spritzler

Joined: Feb 05, 2001
Posts: 17276

Moving to the Struts forum.


Perfect World Programming, LLC - iOS Apps
How to Ask Questions the Smart Way FAQ
sreenath reddy
Ranch Hand

Joined: Sep 21, 2003
Posts: 415

U should not play with response once u have called new ActionForward () ,becoz internally it commits the response and there after u cant include,redirect/dispatch again .

so let me know if u have done something like that
Masha Klimenko
Ranch Hand

Joined: Feb 04, 2004
Posts: 31
As a matter of fact yes. The application was trying to redirect the user to the logon page the first time around, after the forward was already there to take the user to the first page in the application. For now I just put in a cheap fix - exiting out of the action in the beginning if it is the first attempt in the current session to load the page, but please feel free to suggest better approaches.
Marc Peabody
pie sneak

Joined: Feb 05, 2003
Posts: 4727

Run a search on this forum or Google on filters. You can write a filter that checks if the user is logged in.

A good workman is known by his tools.
I agree. Here's the link:
subject: IllegalStateException
It's not a secret anymore!