Tomcat/Servlet Generic Error Handler

R

Rich Morey

Hi --

I am new to Java/Tomcat and I am wondering if it is possible to set
the <error-page> handler in such a way as all errors are redirected to
the specified page without needing to configure each error value.

Thanks

Rich
 
M

Mark Space

Rich said:
Hi --

I am new to Java/Tomcat and I am wondering if it is possible to set
the <error-page> handler in such a way as all errors are redirected to
the specified page without needing to configure each error value.

Thanks

Rich

yeah, "<error-page>" Goes in web.xml. (Are you seeing a trend here?)

Here's some stuff about setting the error page by exception type or
return code:

<http://java.sun.com/developer/EJTechTips/2003/tt0114.html>
 
R

Rich Morey

yeah said:
Here's some stuff about setting the error page by exception type or
return code:

<http://java.sun.com/developer/EJTechTips/2003/tt0114.html>


Hi --

I have the error page set up in web.xml. My question, however, is how
do I make the error handler generic? For example, I have it configured
for error 404, but there may be other errors that occur (400, 401,
501, etc.) Can I set this in such a way as to have ALL errors go to
that error page?

Rich
 
A

Arne Vajhøj

I have the error page set up in web.xml. My question, however, is how
do I make the error handler generic? For example, I have it configured
for error 404, but there may be other errors that occur (400, 401,
501, etc.) Can I set this in such a way as to have ALL errors go to
that error page?

I don't think you can. You need to supply multiple error-page tags.

It is not so bad - the number of HTTP error codes are rather limited.

Alternatively you should specify a super type as exception-type.

Arne
 
R

Rich Morey

I don't think you can. You need to supply multiple error-page tags.

It is not so bad - the number of HTTP error codes are rather limited.

Alternatively you should specify a super type as exception-type.

What is the general exception type for these kind of errors? The page
says "Status report" as the "type" for those errors.

Thanks

Rich
 
A

Arne Vajhøj

Rich said:
What is the general exception type for these kind of errors? The page
says "Status report" as the "type" for those errors.

Catching java.lang.Exception should catch most !

Arne
 
R

Rich Morey

Catching java.lang.Exception should catch most !
Thanks.. I tried this but it doesn't seem to be working. I'm not sure
I have the <error-page> configured correctly as I can't make the
custom error page appear at all. I believe I had it working at one
point but now its not working. Can you offer any tips or things to
check?

Thanks

Rich
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top