I have servlet filter that is invoked ahead of any application code that 
catches all unhandled exceptions, and then it forwards request to appropriate 
page depending on the exception.

I am indeed doing requestDispatcher.forward() and I set attributes on the 
request that are later used in custom error jsp for presentation.

It seems to work fine for all the cases so far except with <jsp:include 
"someservlet/> where someservlet generates runtime exception. (the browser does 
get the right error page, but exceptions are logged from tomcat).


I will experiment with using response.sendError() although it's not clear how 
to pass information back to the page (it appears I can only send a message) , 
such as stack trace, timestsamp of error, etc. I guess I can cramp it into 
message and parse it back in the page, but It does not feel right. 
 I also think that I might be in danger of getting IllegalStateException since 
it's possible that some info can be already written back to the client. Lets 
say, I have multiple <jsp:include "servlet1/>, <jsp:include "servlet2/>, and 
second include generated runtime exception - I suspect this might resolve in 
IllegalStateException during sendError() although i haven't tested it yet.

Thank you for your responses; 


-----Original Message-----
From: Caldarale, Charles R [mailto:chuck.caldar...@unisys.com] 
Sent: Saturday, July 25, 2009 6:48 PM
To: Tomcat Users List
Subject: RE: JSPwriterImpl generates IO exception while processing 
<jsp:include>that gets forwarded.

> From: Leonard Gestrin [mailto:leonard.gest...@markettools.com]
> Subject: JSPwriterImpl generates IO exception while processing
> <jsp:include>that gets forwarded.
> 
> Is it illegal to forward request while processing "include"?

No, but it's illegal to forward a request after the response has been committed.

Are you actually doing a RequestDispatcher.forward() call, or are you using 
HttpServletRequest.sendError()?  The latter is the proper way to trigger the 
error page.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
MATERIAL and is thus for use only by the intended recipient. If you received 
this in error, please contact the sender and delete the e-mail and its 
attachments from all computers.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to