You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by atta ur-rehman <at...@kapsconsulting.com> on 2002/10/22 21:32:17 UTC

IllegalStateException while using

Dear all, 

While conditionally forwarding to another jsp page my Struts/Tiles page throws this exception:

java.lang.IllegalStateException: reset() failed - data has already been sent to client

I don't understand what's going on. Any help would be greatly appreciated.

Regards,

ATTA

RE: IllegalStateException while using

Posted by "Craig R. McClanahan" <cr...@apache.org>.
A <jsp:forward> or RequestDispatcher.forward() call -- which is what
Struts does for you after your Action returns -- is only legal if the
response for the current request has not been committed yet.  It's OK to
start writing to the response, but only if you haven't filled the output
buffer yet.

The same goes for a redirect -- once the response is committed, a redirect
is no longer legal.  Technically, what happens is that when you call
response.sendRedirect() to perform the redirection, the internal
implementation calls response.reset() in order to clear any previously
written headers and data, and then proceeds to write the appropriate
headers to perform the redirect.

Without seeing your code, it's not possible to pinpoint *why* this is
happening to you, but something along this line is definitely the cause of
the exception you are getting.

Craig

On Wed, 23 Oct 2002, James Mitchell wrote:

> Date: Wed, 23 Oct 2002 00:37:10 -0400
> From: James Mitchell <jm...@telocity.com>
> Reply-To: Struts Users Mailing List <st...@jakarta.apache.org>
> To: Struts Users Mailing List <st...@jakarta.apache.org>
> Subject: RE: IllegalStateException while using <jsp:forward>
>
> Did you ever get an answer to this?
>
> This often occurs when doing a forward or redirect after writing to the
> browser.
>
>
> James Mitchell
> Software Engineer/Struts Evangelist
> http://www.open-tools.org
>
> "Only two things are infinite, the universe and human stupidity, and I'm not
> sure about the former."
> - Albert Einstein (1879-1955)
>
>
> > -----Original Message-----
> > From: atta ur-rehman [mailto:attaurrehman@kapsconsulting.com]
> > Sent: Tuesday, October 22, 2002 3:32 PM
> > To: struts users mailing list
> > Subject: IllegalStateException while using <jsp:forward>
> >
> >
> > Dear all,
> >
> > While conditionally forwarding to another jsp page my
> > Struts/Tiles page throws this exception:
> >
> > java.lang.IllegalStateException: reset() failed - data has
> > already been sent to client
> >
> > I don't understand what's going on. Any help would be greatly appreciated.
> >
> > Regards,
> >
> > ATTA
> >
>
>
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: IllegalStateException while using

Posted by James Mitchell <jm...@telocity.com>.
Did you ever get an answer to this?

This often occurs when doing a forward or redirect after writing to the
browser.


James Mitchell
Software Engineer/Struts Evangelist
http://www.open-tools.org

"Only two things are infinite, the universe and human stupidity, and I'm not
sure about the former."
- Albert Einstein (1879-1955)


> -----Original Message-----
> From: atta ur-rehman [mailto:attaurrehman@kapsconsulting.com]
> Sent: Tuesday, October 22, 2002 3:32 PM
> To: struts users mailing list
> Subject: IllegalStateException while using <jsp:forward>
>
>
> Dear all,
>
> While conditionally forwarding to another jsp page my
> Struts/Tiles page throws this exception:
>
> java.lang.IllegalStateException: reset() failed - data has
> already been sent to client
>
> I don't understand what's going on. Any help would be greatly appreciated.
>
> Regards,
>
> ATTA
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>