404,50x Such errors are often encountered.
If the%catalina_home%\conf\web.xml and the specific application have the settings%catalina_home%\webapps\root\web-inf\web.xml
The application is in effect.
How to set up a friendly user experience, for example in the Windows environment:
Add the default file when an exception occurs, the file location is as follows (if you do not set reloadable to True or autodeploy= "true", you will need to restart Tomcat for the changed web. XML to take effect):
(1) Add in Web-app node of%catalina_home%\conf\web.xml
< Error-page > < Error-code >404</error-code> < location >/notfilefound.jsp</location> <!--defined pages must start with "/"-- </ Error-page >
Effect Show:
Normal Condition:
Scene when 404 is present:
%catalina_home%\webapps\root\notfilefound.jsp
(2) The contents of the same format are added in the Web-app node of the%catalina_home%\webapps\root\web-inf\web.xml and (1).
For demonstration purposes, 404.html is used here
Look at the effect when it doesn't exist:
The browser has a masking effect on the 404 configuration of Tomcat:
If you want to make the report 404 direct jump, you can add a jump in the 404.html action will be:
<HTML> <Head> <Metahttp-equiv= "Content-language"content= "ZH-CN"> <Metahttp-equiv= "Content-type"CONTENT= "text/html; charset=gb2312"> <Meta http-equiv= "Refresh" content= "0.1;url=http:// Www.cnblogs.com "> <title></title> </Head> <Body> </Body> </HTML>
3. Not only can you go to the page based on the HTML error code, but you can also jump by exception type, for example:
<error-page>
<exception-type>javax.servlet.ServletException</exception-type>
<location>/errorhandler.jsp</location>
</error-page>
Not only can you use the JSP built-in exception object to get the exception, you can also get the attribute in request. For example:
<% @page contenttype= "Text/html;charset=big5" iserrorpage= "true"%>
Http://www.cnblogs.com/yjhrem/articles/2206878.html
Configuring a custom 404 error page in tomcat