Les Hartzman typed the following on 04:36 PM 2/7/2001 -0800
>Using Tomcat 3.2.1, is it possible to define/display custom error pages
>based on errors that occur within a servlet? No JSPs are used; this is a
>servlet/EJB environment.
>
>I've seen in the spec for web.xml that there is an error-page element for
>either a general error code or an exception type. But is final granularity
>possible based on some servlet action?
I'm not sure what you mean by that last sentence. You can throw
whatever exceptions you want in your servlet to force handling by
a particular error page. Create custom exception subclasses and
throw those in your servlet.
<error-page>
<exception-type>com.myco.myproject.FooException</exception-type>
<location>/servlets/FooExceptionServlet)</location>
</error-page>
Section 9.8 of the 2.2 specification explains how to find the error conditions in
your servlet.
Note that there has been a bug which causes Tomcat to choke if you use
a non JSP/servlet resource to handle error-pages, i.e. using a flat HTML page
kills it. I'm not sure if this is still a bug.
Kief
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]