tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Frank Burns" <>
Subject Help with handling exceptions
Date Mon, 19 Apr 2004 13:07:56 GMT

Please help.

What I would like to do is redirect, or forward, to another page when an
exception occurs in certain JSP pages.

I call some JSPs that utilize beans (via JSTL) that have getter methods
which perform database access. These getter methods can generate exceptions.
When they do, the JSP simply incorporates some text, indicating the
exception, into the rest of the JSP's template text.

I have included <error-page> elements in the web.xml file, like this:


And other less general exception types. But these are all just ignored. Why?

I've also tried other methods, using JSTL. For example, I catch the
exception, using <c:catch ...>,and try to forward using <jsp:forward ...>.
But I get the following response incorprated into the original called JSP:

    [Exception in:../foo.jsp] Cannot forward after response has been

Also, when I catch the exception and try to redirect using <c:redirect ...>
I get the original called JSP with nothing incorprated into it.

I deduce form this, that the problem is that some of the JSP page's content
has already been committed, and so the forward or redirect is prohibited. Is
this correct?

SO MY QUESTION IS: How can I achieve my objective of displaying an error
page when an exception occurs?



To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message