JSP 404 errorpage custom page processing

Source: Internet
Author: User

When browsing a webpage, we often enter a webpage that may not exist on the server, but we do not want to use the error handling page provided by the server to define a 404 error handling page for ourselves, this is also more lively and interesting .... the following is the defined method. first, write your own error page,

First, we define an error handling JSP page error.jsp?error.html page

 
1:<HTML>
2:<Head>
 
3:<Title> Error 404 page </title>
4:</Head>
 
5:<Body>
  6:  
   
   
"center" style = " margin-top: 200px; " congratulations! You came to the 404 page... the current file does not exist... hahaha
7:</Body>
 
8:</Html>

 

You can write some more interesting error pages by yourself ....

Configure the following in the web. XML page:Code:

 
1:<Error-page>
 
2:<Error-code> 404 </error-code>
3:<Location>/error. jsp </location>
 
4:</Error-page>

 

Of course, we can also use the same method to define other errors, 400,500 errors, and so on.

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.