File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes Illegal State Exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Illegal State Exception" Watch "Illegal State Exception" New topic

Illegal State Exception

Vaibhav Deshpande
Ranch Hand

Joined: Apr 26, 2002
Posts: 33
In my JSP page i have many response.sendRedirect. Is this teh reason for above exception that is more response.sendRedirect then one on same jsp
can some one help me out.
David O'Meara

Joined: Mar 06, 2001
Posts: 13459

More than likely. This is a big argument for only placing sendRedirects and forwards in Servlets and never in JSPs.
If the buffer for the output has filled, the response will be sent to the client, and the response is 'comitted'. That is, it is now too late to send them something else or somewhere else. You need to make these decisions before you start outputting data to the client, which is why the MVC architecture and Servlets is a much better way to manage this.
Some people solve this by making the buffer larger, but this is inefficiant and only hides the problem. It doesn't solve it.
I agree. Here's the link:
subject: Illegal State Exception
It's not a secret anymore!