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