在写SSM项目时找的网页模板,但是放在项目里后效果突然失效了,图片也显示不了了,很头疼
在网上找了很多办法,大家都说是过滤器的问题,所以我一开始按照第一种方法,在web.xml中加入
<servlet-mapping>
<servlet-name>defaultservlet-name>
<url-pattern>*.jpgurl-pattern>
servlet-mapping>
<servlet-mapping>
<servlet-name>defaultservlet-name>
<url-pattern>*.eoturl-pattern>
servlet-mapping>
<servlet-mapping>
<servlet-name>defaultservlet-name>
<url-pattern>*.svgurl-pattern>
servlet-mapping>
<servlet-mapping>
<servlet-name>defaultservlet-name>
<url-pattern>*.ttfurl-pattern>
servlet-mapping>
<servlet-mapping>
<servlet-name>defaultservlet-name>
<url-pattern>*.woffurl-pattern>
servlet-mapping>
<servlet-mapping>
<servlet-name>defaultservlet-name>
<url-pattern>*.lessurl-pattern>
servlet-mapping>
<servlet-mapping>
<servlet-name>defaultservlet-name>
<url-pattern>*.scssurl-pattern>
servlet-mapping>
<servlet-mapping>
<servlet-name>defaultservlet-name>
<url-pattern>*.woff2url-pattern>
servlet-mapping>
<servlet-mapping>
<servlet-name>defaultservlet-name>
<url-pattern>*.otfurl-pattern>
servlet-mapping>
<servlet-mapping>
<servlet-name >default servlet-name >
<url-pattern >*.pngurl-pattern>
servlet-mapping >
<servlet-mapping>
<servlet-name >default servlet-name >
<url-pattern >*.gifurl-pattern>
servlet-mapping >
<servlet-mapping>
<servlet-name >default servlet-name >
<url-pattern >*.jsurl-pattern>
servlet-mapping >
<servlet-mapping >
<servlet-name >default servlet-name >
<url-pattern >*.cssurl-pattern>
servlet-mapping >
<servlet-mapping >
<servlet-name >default servlet-name >
<url-pattern >*.htmurl-pattern>
servlet-mapping >
<servlet-mapping >
<servlet-name >default servlet-name >
<url-pattern >*.imageurl-pattern>
servlet-mapping >
⛔结果没啥用!!
<mvc:resources mapping="/js/**" location="/js/"/>
<mvc:resources mapping="/css/**" location="/css/"/>
<mvc:resources mapping="/fonts/**" location="/fonts/"/>
<mvc:resources mapping="/font-awesome/**" location="/font-awesome/"/>
<mvc:resources mapping="/js/**" location="js/"/>
<mvc:resources mapping="/css/**" location="css/"/>
<mvc:resources mapping="/fonts/**" location="fonts/"/>
<mvc:resources mapping="/font-awesome/**" location="font-awesome/"/>