J2EE for SpringMVC 映射静态资源独Js不成功的问题解决
2017-08-08 18:53
513 查看
刚才博主遇到一个很头大的问题,静态资源映射了,路径语法啥的都没问题而css和img又能够映射成功,能够正常读取,经过反复检查,博主发现是版本跟不上了。
看看博主的配置先:
问题就处在了schema:
看看博主的配置先:
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd">
<!--本项目把静态资源放在了WEB-INF的statics目录下,资源映射如下--> <mvc:resources mapping="/css/**" location="/WEB-INF/statics/css/"/> <mvc:resources mapping="/js/**" location="/WEB-INF/statics/js/"/> <mvc:resources mapping="/img/**" location="/WEB-INF/statics/img/"/>
问题就处在了schema:
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">[/code]
这样写就没问题了。
关键:http://www.springframework.org/schema/mvc/spring-mvc.xsd 和 http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd[/code]
只需要加上-3.0就ok了!
相关文章推荐
- J2EE for Spring MVC注解的方式把对象转换成json不成功的问题解决
- 96. Spring Boot之静态资源版本映射(解决js/css缓存问题)
- 【Spring】Spring3中js/css/jpg/gif等静态资源无法找到(No mapping found for HTTP request with URI)问题解决
- 解决SpringBoot 整合 FreeMaker,不能js,css静态资源的问题
- spring MVC js css图片等静态资源无法加载问题
- Spring3中js/css/jpg/gif等静态资源无法找到(No mapping found for HTTP request with URI)问题解决
- 【js类库AngularJs】解决angular+springmvc的post提交问题
- 【js类库AngularJs】解决angular+springmvc的post提交问题
- springMVC js等文件找不到错误,也就是访问不了静态资源
- SpringMVC Restful风格 css、js、img资源失效的问题
- Spring3中js/css/jpg/gif等静态资源无法找到(No mapping found for HTTP request with URI)问题解决
- Spring3中js/css/jpg/gif等静态资源无法找到(No mapping found for HTTP request with URI)问题解决
- No mapping found for HTTP request with URI 找不到图片或者其他的静态资源问题解决办法
- Spring3中js/css/jpg/gif等静态资源无法找到(No mapping found for HTTP request with URI)问题解决
- 解决springboot项目打war 包docker包找不到resource 下的静态资源问题
- web项目中url-pattern改成'/'后,js、css、图片等静态资源(404)无法访问问题解决办法
- Spring3中js/css/jpg/gif等静态资源无法找到(No mapping found for HTTP request with URI)问题解决--转载
- Spring3中js/css/jpg/gif等静态资源无法找到(No mapping found for HTTP request with URI)问题解决
- 【js类库AngularJs】解决angular+springmvc的post提交问题
- Spring3中js/css/jpg/gif等静态资源无法找到(No mapping found for HTTP request with URI)问题解决