SpringMVC找不到JS文件,搞了半天。
浏览器控制台报错信息:
jquery-1.11.0.min.js Failed to load resource: the server responded with a status of 404 (Not Found)
json2.js Failed to load resource: the server responded with a status of 404 (Not Found)
converter:10 Uncaught ReferenceError: $ is not defined
控制台报错信息:
23:26:19,033 WARN [org.springframework.web.servlet.PageNotFound] (default task-5) No mapping found for HTTP request with URI [/springmvc/js/jquery-1.11.0.min.js] in DispatcherServlet with name 'springmvc'
23:26:19,043 WARN [org.springframework.web.servlet.PageNotFound] (default task-6) No mapping found for HTTP request with URI [/springmvc/js/json2.js] in DispatcherServlet with name 'springmvc'
错误

博客讲述了在使用SpringMVC时遇到的404错误,问题在于SpringMVC DispatcherServlet无法找到JS文件。浏览器控制台显示jquery-1.11.0.min.js和json2.js加载失败,导致$未定义的引用错误。错误原因是DispatchServlet将'/js/'路径误认为HTTP请求,未找到映射。解决方法是配置SpringMVC以处理静态资源请求。
最低0.47元/天 解锁文章
356

被折叠的 条评论
为什么被折叠?



