How to Set default homepage-index. Do for virtual files in Web. xml

Source: Internet
Author: User

When using struts, you sometimes need to use index. Do to obtain data and then display it in index. jsp of the Home Page. In this case, you need to set index. Do as the home page. However, because the welcome page in Web. xml must be a physical file configured with welcome-file, Tomcat will not continue to process the homepage such as index. Do, but return 404 directly.

According to a comment in Tomcat:

When a request URI refers to a directory, the default servlet looks for a "Welcome file" within that directory and, if present, to the corresponding resource URI for display.

That is to say, as long as Tomcat finds a physical file with such a name, it will go to the following for further processing. It is easy to create an empty file in the directory named index. do (a little fool Tomcat), everything is done!

 

 
<Welcome-file-List> <welcome-File> test. DO </welcome-File> </welcome-file-List>

 

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.