Home > Web Xml Error > Jsp Error Pages Web Xml

Jsp Error Pages Web Xml

here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us web.xml error-page example Learn more about Stack Overflow the company Business Learn more about hiring developers web.xml error-page exception-type or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack web.xml error-page location Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up How to specify the default error page error page jsp in web.xml? up vote 85 down vote favorite 37 I am using element in web.xml to specify the friendly error page when user encounters a certain error such as error with code of 404: 404 /Error404.html However, I want that if the user does not meet any error code specified in , he or she should see a default error page. How can I

Web.xml Error Handling

do that using the element in the web.xml? java servlets tomcat6 web.xml custom-error-pages share|improve this question edited Sep 18 '14 at 14:42 Jayy 1,59321525 asked Aug 15 '11 at 14:34 ipkiss 4,099195895 2 What servletcontainer are you using/targeting and what servlet version is your web.xml declared to? There's only since Servlet 3.0 an easy way. –BalusC Aug 15 '11 at 14:44 I am using Tomcat 6, servlet 2.5 –ipkiss Aug 15 '11 at 14:49 add a comment| 2 Answers 2 active oldest votes up vote 161 down vote accepted On Servlet 3.0 or newer you could just specify /general-error.html But as you're still on Servlet 2.5, there's no other way than specifying every common HTTP error individually. You need to figure which HTTP errors the enduser could possibly face. On a barebones webapp with for example the usage of HTTP authentication, having a disabled directory listing, using custom servlets and code which can possibly throw unhandled exceptions or does not have all methods implemented, then you'd like to set it for HTTP errors 401, 403, 500 and 503 respectively. 401 /general-error.html