Solution to the "404 Not Found" error of spring MVC

Source: Internet
Author: User

Generally, this problem does not occur on the web. the servlet URL ing part of the XML configuration file, because this URL ing is often configured by Java Web users, and this ing degree of freedom is large here, you can have a directory string, or not, only the final file name matching method. Therefore, the problem generally lies in the definition of controller ing configuration, because if the dispatchservlet distributor cannot find the Controller controller corresponding to the request URL in its configuration file, the 404 Not Found error will also be returned. The URL definition in the controller, whether it is the name attribute in the beannameurlhandlermapping configuration or the key attribute in the simpleurlhandlermapping configuration, must show the absolute path of the server project of the URL when defining the URL location, that is to say, it is not necessary to omit imaging as long as the last part of the URL appears as described in some books or documents that are not rigorous or outdated. In fact, this is not the case, the definition here must be written to the absolute path of the server project, that is, the part following the project deployment name in the URL. Some web projects are directly deployed under the domain name root directory, it is the part after the domain name. To put it simply, it is in the web. the pattern in the URL in which the servlet ing is defined in XML

References: http://blog.csdn.net/wangyaoheng/article/details/2465834

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.