On Fri, 16 Nov 2001, Fabien Modoux wrote:

> Date: Fri, 16 Nov 2001 11:32:08 -0500
> From: Fabien Modoux <[EMAIL PROTECTED]>
> Reply-To: Tomcat Users List <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Subject: error-page usage in web.xml
>
> Hello,
>
> I am having trouble understanding how to properly configure
> the error-page section of my web.xml. I found some previous
> posts, but could not find enough information.
>
> There are two types of error-page element: exception-type and
> error-code. Are those complimentary -- i.e., they must both be
> defined to handle all errors -- or is there some sort of overlap?

There's no overlap.

The <exception-type> error pages are consulted when your servlet throws an
exception instead of returning normally from the service() method.

The <error-code> error pages are consulted when your servlet returns
normally from the service() method, but you've set the HTTP response
status to something other than 200.

> I did a few tests and I don't think 404 cannot be handled as an
> exception, only with the error-code element. However I am
> wondering about the difference between error-code 500 and
> exception-type java.lang.Throwable, which one is the most general
> one?
>

If your servlet throws an exception, and you have *not* defined an error
page for that exception, Tomcat creates a default "error 500" page for
you.

> I've also seen a post (#33290) saying that
>
> > Within the page, you can access (among others) the following request
> > attribute created by the container:
> >
> >   <%
> >     String requestURI = (String)
> >      request.getAttribute("javax.servlet.error.request_uri");
> >   %>
>
> I am using TC3.2.2 and the attribute has the value of the error
> handler page, not of the page that created the error. Is the possible
> to get the latter info?
>

Sounds like a bug in 3.2.2 -- it should be the request URI of the original
page.

> Thanks for your help,
>
> -Fabien
>

Craig McClanahan


--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>

Reply via email to