tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ethan Wallwork" <ethan.wallw...@pre-print.com>
Subject Error handling with RequestDispatcher
Date Mon, 02 Oct 2000 20:30:38 GMT

Situation:

A servlet handles a request from the client.  Depending on the parameters given by the client
and the phase of the moon, a
particular JSP file is chosen.  The output of the JSP is included in the output of the servlet
using the include() method of
RequestDispatcher.

Problem:

If my JSP throws a ServletException, the servlet including it does not receive the exception.
 Instead, the exception gets "handled"
by Tomcat.

Analysis:

My interpretation of the servlet 2.2 spec is such that exceptions from included servlets (and
JSPs) should be propagated to the
calling servlet.  Here is the relevant passage (section 8.5):

---
ERROR HANDLING

Only runtime exceptions and checked exceptions of type ServletException or IOException should
be propagated to the calling servlet
if thrown by the target of a request dispatcher.  All other exceptions should be wrapped as
a ServletException and the root cause of
the exception set to the original exception.
---

While this passage does not explicitly state that exception should be propagated, it strongly
implies it.

Am I wrong in my understanding of the spec or of what Tomcat is doing, or is this really a
violation of the spec?

--
Ethan




Mime
View raw message