Java Web project-configure the exception handling interface in Web. xml

Source: Internet
Author: User
1 <? Xml version = "1.0" encoding = "UTF-8"?> 2 <web-app version = "2.4" 3 xmlns = "http://java.sun.com/xml/ns/j2ee" 4 xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance" 5 xsi: schemaLocation = "http://java.sun.com/xml/ns/j2ee 6 http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> 7 8 <error-page> 9 <error-code> 404 </error-code> 10 <location>/notfound. jsp </location> 11 </error-page> 1213 <error-page> 14 <error-code> 500 </error-code> 15 <location>/error. jsp </location> 16 </error-page> 17 18 </web-app>

In a java web project. after the preceding two <error-pages> are configured in xml, the page will jump to notfound under WebRoot as long as the page has a 404 error. the jsp page will jump to error if a 500 error occurs. jsp page instead of redirecting to a 404 html error page.

For more information about the threat of redirecting to an html error page of 404 or 500 to a website, see my other blog post: How to declare and use the error handling page of JSP.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.