& Lt; welcome-file & gt; index. action & lt;/welcome-fil

Source: Internet
Author: User

In the past few days, the access to the project page is changed to. action access, and a problem occurs when you modify the home page. Modify <welcome-file> index. action </welcome-file> in the web. xml file to this way. When you access the home page, the system reports a 404 error, which means the file cannot be found. There are two solutions for online query.
Method 1: Create an empty index. action file under WebRoot. This method is simple and practical and is strongly recommended.
Method 2: Because the welcome-file must be an existing file, not an action or servlet Path, you can set a goindex such as <welcome-file>. jsp </welcome-file>, and then goindex. jsp write <jsp: forward page = "index. action "/>. This means that a jsp page is used to forward requests to the action.

Method 3: Use META redirection in index.html.

Actions: <META HTTP-EQUIV = "Refresh" CONTENT = "0; URL = max/HelloWorld. action">

Where,

Content = "1 is the time control, indicating that the page to jump is automatically redirected after 1 second. content =" 0 indicates that the page will be redirected to the page you want to jump to immediately.
Url is the path to jump

----------------------------------------------

Cause:

Struts2 uses a filter to process requests. By default, it monitors url address changes.

Step 1:
Modify in web. xml
<Filter-mapping>
<Filter-name> struts2 </filter-name>
<Url-pattern>/* </url-pattern>
<Dispatcher> REQUEST </dispatcher> <dispatcher> FORWARD </dispatcher>
</Filter-mapping>
Step 2:
Add in web. xml
<Welcome-file-list>
<Welcome-file> index. jsp </welcome-file>
</Welcome-file-list>
Step 3:
Homepage jump statement
The content of index. jsp is as follows:
<Jsp: forward page = "HelloWorld. action"> </jsp: forward>

Or use method 3 !!!

From: http://blog.sina.com.cn/s/blog_4b5bc0110100yrn2.html

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.