Problem performance:
Eclipse in the use of the SPRING-MVC framework to develop Web projects, the project will be able to access the JSP page after normal startup, but the JSP page page effect does not take effect, and prompted the JSP file hint JS can not find, 404 error.
(1) Preliminary judgment:
When debugging in the browser, JSP page prompt JS file can not find, prompt 404 error. Because the project name is Littlec-exchange-center, the URL in the access is Exchangecenter, the initial judgment is the path is wrong.
Try to fix: View the Server.xml configuration under Tomcat's Conf path as follows:
As you can see, although the package file path under Tomcat is Littlec-exchange-center, the access path is/exchangecenter. So the path is fine.
(2) Continue to look for: in the browser source view can not find the JS file, but the project package into Tomcat has JS file, further judgment is JS and other static file access problems.
Try to solve: in the same path as the JSP file, create a new test.html, which writes "test". Direct access to localhost:8080/exchangecenter/test.html, or a 404 error is indicated.
You can basically determine the issue of static resource access. SPRING-MVC where static resource loading is configured in our defined Dispatcher-servelt.xml file, after spring-mvc3.0, it is recommended to use the configuration:
< Mvc:annotation-driven />
<mvc:resources Mapping="/resources/**/" Location="/resources/"/>
With this configuration, spring can be found when image,css and other files are placed in the resources file.
This article is from the "go it on the Road" blog, be sure to keep this source http://andrewli.blog.51cto.com/7625043/1925617
Analysis of an issue where static files cannot be loaded when you start a SPRING-MVC project in eclipse