No mapping found for HTTP request with URI [/superMarket/css/style.css] in DispatcherServlet with na
来源:互联网 发布:天宇全站仪数据导出 编辑:程序博客网 时间:2024/05/21 06:56
在测试写的前端代码的时候遇到问题
[org.springframework.web.servlet.PageNotFound] - No mapping found for HTTP request with URI [/superMarket/css/style.css] in DispatcherServlet with name ‘SpringMVC’
页面出现以上内容。
罪魁祸首是web.xml下对spring的DispatcherServlet请求url映射的配置,原配置如下:
分析原因:的/把所有的请求都交给spring去处理了,而所有available的请求url都是在Constroller里使用类似@RequestMapping(value = “/login/{user}”, method = RequestMethod.GET)这样的注解配置的,这样的话对js/css/jpg/gif等静态资源的访问就会得不到。
解决方法:
在xml中加入:
<servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>*.css</url-pattern></servlet-mapping><servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>*.gif</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>*.jpg</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>*.js</url-pattern> </servlet-mapping>
解决!
0 0
- No mapping found for HTTP request with URI [/superMarket/css/style.css] in DispatcherServlet with na
- SSM报错:No mapping found for HTTP request with URI [/smbms/js/echarts.js] in DispatcherServlet with na
- No mapping found for HTTP request with URI [/login.do] in DispatcherServlet with name 'spring'
- No mapping found for HTTP request with URI [/cwgl/department/index] in DispatcherServlet with name
- No mapping found for HTTP request with URI[路径] in DispatcherServlet with name spring3
- 警告: No mapping found for HTTP request with URI [/Springmvc/test] in DispatcherServlet with dispatche
- No mapping found for HTTP request with URI [/...] in DispatcherServlet with name ...的解决方法
- No mapping found for HTTP request with URI [/index.html] in DispatcherServlet with name 'springmvc'
- No mapping found for HTTP request with URI [/springmvc/queryitems.action] in DispatcherServlet with
- 警告: No mapping found for HTTP request with URI [] in DispatcherServlet with name
- Spring : No mapping found for HTTP request with URI in DispatcherServlet with name "..."
- No mapping found for HTTP request with URI [/chart/get] in DispatcherServlet with name 'SpringMVC‘
- No mapping found for HTTP request with URI [/prjName/contro] in DispatcherServlet with name 'spring'
- No mapping found for HTTP request with URI [/index.do] in DispatcherServlet with name 'SpringMVC‘
- No mapping found for HTTP request with URI in DispatcherServlet with name 'XXX'
- No mapping found for HTTP request with URI [...] in DispatcherServlet with name '...'
- No mapping found for HTTP request with URI [/bdp/] in DispatcherServlet with name
- No mapping found for HTTP request with URI [/] in DispatcherServlet with name 'projectname'
- Landscaping Gym
- 好好说话——表达能力
- jQuery源码分析-03构造jQuery对象-源码结构和核心函数
- Visual Studio Code(vscode) 创建Node.js+Express+handlebars项目 --Express概述
- Android原生集成React Native遇到的问题
- No mapping found for HTTP request with URI [/superMarket/css/style.css] in DispatcherServlet with na
- mysql 写一个带有一定逻辑的存储过程
- ResponseEntity发送乱码,HttpResponse response接收乱码问题解决
- STM32之CAN ---CAN ID过滤器分析
- 每日一题 No.5 括号匹配
- 多态
- 【序列】列表
- JAVA控制执行流程学习过程
- tcp/ip和udp之间的区别