About STRUTS2 Basic cases there are always 404 wrong solutions

Source: Internet
Author: User
About STRUTS2 Basic cases there are always 404 wrong solutions

First I was a little white, recently in contact with the struts2 frame. In the learning process of watching video, there is a 404 problem. I follow the video on the basis of the case, the data are the same, when I run the time there are always 404 errors, make me very anxious. Then I found a lot of information on the Internet to find that it was not the problem of the code, but that there was a problem in building the project. When building a Web project, there will be a Dynamic Web module version, the default is to choose version 3.0, but should be selected 2.5, my tomcat is 7.0. Re-build the Web project, choose the correct version of the problem is solved.

Then I summed up a few easy to lead to 404 error places, for your reference:
1. In the configuration file, the extends= "Struts-default" property of the package tag is correct, which is fixed. Also note that the Name property of the action tag matches the names you access.
2.struts2 configuration file name and location is fixed, the name is Struts.xml, location in the SRC directory.
3. In the Web-inf directory, the Web. XML configuration file must be careful to see if the interceptor is configured.

This is my summary of the easy to make a few mistakes, I hope to be able to help small white like me.

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.