【发布时间】:2017-01-14 14:45:56
【问题描述】:
我有 dispatcher-servlet 作为
<mvc:resources mapping="/css/**" location="/css/"></mvc:resources>
<mvc:resources mapping="/fonts/**" location="/fonts/"></mvc:resources>
<mvc:resources mapping="/images/**" location="/images/"></mvc:resources>
<mvc:resources mapping="/js/**" location="/js/"></mvc:resources>
<context:component-scan base-package="com.temple.controller"/>
<bean id="viewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver"
p:prefix="/WEB-INF/jsp/"
p:suffix=".jsp" />
此映射在 url 包含“root-url/css”之前有效。现在,当我在我的项目中通过管理员登录时,url 变为“root-url/admin/css”,并且使用的 css 无法显示。
The stylesheet http://localhost:8126/hello/admin/css/entypo.css was not loaded because its MIME type, "text/html", is not "text/css".
现在我的问题是如何通过映射所有 url 的资源来解决所有这些问题。我已经尝试了 stackoverflow 中描述的几乎所有映射问题,但我没有产生任何结果。谁能解释一下我该如何解决这个问题?
【问题讨论】:
-
显示有
link href="entypo.css" rel="stylesheet" type="text/css" />的jsp -
我应该展示什么部分?
标签: java spring-mvc mapping