tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kief Morris <>
Subject Re: Custom error pages from servlets?
Date Thu, 08 Feb 2001 09:19:01 GMT
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.


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. 


View raw message