spring_mvc.xml中添加
<!--静态资源映射--> <!--本项目把静态资源放在了content目录下,资源映射如下--> <mvc:resources mapping="/css/**" location="/content/css/"/> <mvc:resources mapping="/js/**" location="/content/js/"/> <mvc:resources mapping="/images/**" location="/content/images/"/> <mvc:default-servlet-handler />
其中,一定要添加:
<mvc:default-servlet-handler />