When the Web application delivered to the user error, generally do not want to display system-level original error to the user, so it is too unfriendly, will let the user feel inexplicable, in order to make error information more humane principle, the general need for the Web application error handling. Error handling, typically using three pages for processing, 400 errors, 404 errors, and 500 errors, the three errors are most common.
Add in Web.xml:
<error-page>
<error-code>400</error-code>
<location>/error/400.jsp</location>
</error-page>
<error-page>
<error-code>404</error-code>
<location>/error/404.jsp</location>
</error-page>
<error-page>
<error-code>500</error-code>
<location>/error/500.jsp</location>
</error-page>
Then create 400.jsp, 404.jsp, and 500.jsp pages in the Web program separately
For example
404.JSP:
<%@ page language= "java" import= "java.util.*" pageencoding= "Utf-8" iserrorpage= "true"%>
<%
Response.setstatus (HTTPSERVLETRESPONSE.SC_OK);
%>
<title></title>
<body>
404 error, unable to find the page.
</body>
Create 400.jsp and 500.jsp error-handling pages like this
Attention:
<%@ page language= "java" import= "java.util.*" pageencoding= "Utf-8" iserrorpage= "true"%>
<%
Response.setstatus (HTTPSERVLETRESPONSE.SC_OK);
%>
Iserrorpage to be set to True
Response.setstatus (HTTPSERVLETRESPONSE.SC_OK) This must be set, if the use of IE browser enabled "show friendly HTTP error message", but not set this, then your own set error page will not work.