Hi,
How to correctly display the error page when some content has been written to the OutputStream? When an exception occurs in some nested jsp component (e.g. a tile inserted by <tiles:insert or some other tag), how do you display the error page rather than the partially returned content. A while ago, the error page would be displayed in the place of the errant component within the returned html. This could lead to the error page being embedded within other pages. This is no longer happening with Tomcat as I get an IllegalStateException - presumably as tomcat knows it has already written some content to the OutputStream
A previous worked around (back in the days of struts 1.1) was:
1) declare an error jsp
2) within that jsp, store the exception in the session
3) the error jsp does a meta refresh to the real error page
<META HTTP-EQUIV="Refresh" CONTENT="0;url=<%=request.getContextPath() %>/RealError.jsp">
4) In the RealError.jsp display the exception from the session.
Is this the only way to resolve the problem or is there something I've missed in struts that does this for me?
I guess I'd have to write the "Meta refresh" in some exception handling code if tomcat is going to complain if I attempt to use declared servlet exception handling after content has been written to the OutputStream.
Other solutions that could work - buffer all output, don't write to the output stream until you're sure no exceptions have been thrown, then std servlet exception handling should work. No idea how to do this but if its possible I guess it's a tomcat config.
cheers Nathan
-- Nathan Coast Managing Director Codeczar Ltd mob : (852) 9049 5581 tel : (852) 2834 8733 fax : (852) 2834 8755 web : http://www.codeczar.com
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]