网上解决方法大致两种。
1.web.xml文件配置
–>
default
.css
.gif
.jpg
.png
.js
.html
–>
``
2.配置静态资源映射,sprmvc的配置文件配置如下
<mvc:resources mapping="/favicon/**" location="/views/favicon/"/>
<mvc:resources mapping="/images/**" location="/views/images/"/>
<mvc:resources mapping="/vendor/**" location="/views/vendor/"/>
<mvc:resources mapping="/stylesheets/**" location="/views/stylesheets/"/>
<mvc:resources mapping="/javascripts/**" location="/views/javascripts/"/>
在html或者jsp界面,引用css样式等使用相对路径。ctroller层的requestmapping最好不要使用两层,因为html使用相对路径只能退到父目录(可能是个人问题)。