这是我总结的几种解决办法,可以自行尝试实在不行都加上.
第一种在springmvc配置文件当中加入资源映射
1 <!-- 放行静态资源 --> 2 <mvc:default-servlet-handler/> //如果加了这一句的话下面就不用加了,如果加这句不好使再加下面的这些 3 4 <!-- <mvc:resources mapping="/easyUI/**" location="/easyUI/" /> 5 <mvc:resources mapping="/imags/**" location="/imags/"/> 6 <mvc:resources mapping="/js/**" location="/js/"/> 7 <mvc:resources mapping="/zTree_v3/**" location="/zTree_v3/"/> 8 <mvc:resources mapping="/images/**" location="/images/"/> 9 -->
第二种情况在web.xml配置
1 <servlet-mapping> 2 <servlet-name>default</servlet-name> 3 <url-pattern>*.jpg</url-pattern> 4 </servlet-mapping> 5 <servlet-mapping> 6 <servlet-name>default</servlet-name> 7 <url-pattern>*.js</url-pattern> 8 </servlet-mapping> 9 <servlet-mapping> 10 <servlet-name>default</servlet-name> 11 <url-pattern>*.css</url-pattern> 12 </servlet-mapping> 13 <servlet-mapping> 14 <servlet-name>default</servlet-name> 15 <url-pattern>*.html</url-pattern> 16 </servlet-mapping>
第三种情况是可能配置拦截器了,拦截器拦截了 ,如果没有加拦截器的话不考虑这种情况
1 <mvc:interceptors> 2 <!– 权限拦截器–> 3 <mvc:interceptor> 4 <mvc:mapping path="/**"/> 5 <!–放行静态资源–> 6 <mvc:exclude-mapping path="/css/**"/> 7 <mvc:exclude-mapping path="/demo/**"/> 8 <mvc:exclude-mapping path="/easyUI/**"/> 9 <mvc:exclude-mapping path="/images/**"/> 10 <mvc:exclude-mapping path="/js/**"/> 11 <ref bean="loginInterceptor"/> 12 </mvc:interceptor> 13 </mvc:interceptors>-->
转:https://blog.csdn.net/kxj19980524/article/details/85002565