Relative path get project file and error No mapping found for HTTP request with URI XXX in Dispatcherservlet with Name ' SPRINGMVC ' workaround

Source: Internet
Author: User

First of all, the files in the Webroot directory are all available through the browser input path, directly read to the

For example, this:

The webroot below Web-inf cannot be read directly by the browser input path.

Because it's protected.

If the JSP reads a picture.

JSP under the webroot/jsp

Picture under the Webroot/imag

Then we have to. /imag/xx.jpg gets the relative path.

Because the servlet program is unable to read an absolute path such as C:\xx\xx\xx.

Unless you change the Tomcat configuration file, I think that's completely meaningless.

Also, be aware that the path you are requesting is blocked.

For example, Web. XML is configured with Servlet-mapping (this is the Spring MVC configuration):

<servlet-mapping>
<servlet-name>springMVC</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>

Then all requests will be intercepted, searching for beans or annotations in the SPRINGMVC, if the report 404 error is not found. It is also impossible to get the image path directly from the JSP.

Error

No mapping found for HTTP request with URI, XXX in Dispatcherservlet with Name ' Springmvc '

Relative path get project file and error No mapping found for HTTP request with URI XXX in Dispatcherservlet with Name ' SPRINGMVC ' workaround

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.