Yes, the servlet specification provides a specific means of doing this: <web-app> ... <error-page> <error-code>404</error-code> <location>/MyCustomErrorPage.html</location> </error-page> ... </web-app> All Servlet 2.2 or 2.3 compliant containers are required to implement this. Note that this entry must be in the correct place in the web.xml, after all the <servlet> and <servlet-mapping> elements. It is worth downloading the DTD and looking through it. There are a number of features available that are not widely known. You can download it from http://java.sun.com/j2ee/dtds/web-app_2_2.dtd The servlet 2.3 DTD is found at http://java.sun.com/dtd/web-app_2_3.dtd
Phil Hanna<BR>Sun Certified Programmer for the Java 2 Platform<BR>Author of :<BR><A HREF="http://www.amazon.com/exec/obidos/ASIN/0072127686/electricporkchop/107-3548162-1137317" TARGET=_blank rel="nofollow">JSP: The Complete Reference</A><BR><A HREF="http://www.amazon.com/exec/obidos/ASIN/0072124253/electricporkchop/107-3548162-1137317" TARGET=_blank rel="nofollow">Instant Java Servlets</A>
subject: How to display a customized "Error 404" page?