Re: Custom error pages from servlets?

2001-02-08 Thread Kief Morris

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-typecom.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]




Custom error pages from servlets?

2001-02-07 Thread Les Hartzman

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?

Thanks.

Les


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




Re: Custom error pages from servlets?

2001-02-07 Thread Pete Ehli

catch try blocks - out.println(Your custom error message!);
-- Pete --
- Original Message -
From: "Les Hartzman" [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, February 07, 2001 4:36 PM
Subject: Custom error pages from servlets?


 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?

 Thanks.

 Les


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, email: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]