Spring错误包括静态资源

时间:2016-02-07 11:14:42

标签: css spring-mvc resources

我的spring mvc项目中包含静态资源的错误 我的css在/webapp/resources/css

我的spring dispatcher servlet中有以下几行:

<mvc:resources mapping="/webjars/**" location="classpath:/META-INF/resources/webjars/"/>
<mvc:resources mapping="/resources/**" location="/resources/" />

我将它包含在我的jsp文件中,如下所示:

<link href="<c:url value="/resources/css/mycompany.css" />" rel="stylesheet">

问题是它只在我的网址如下时才起作用:
http://localhost:8080/MyProject/firstLevel

但如果我的网址是这样的,那就不行了:
http://localhost:8080/MyProject/firstLevel/secondLevel

如果我打开控制台,我会看到错误:

  

&#34;无法加载资源:服务器响应状态为404&#34;

http://localhost:8080/MyProject/firstLevel/webjars/jquery/2.1.4/jquery.min.js

中的

因为我认为必须找到它:
http://localhost:8080/MyProject/webjars/jquery/2.1.4/jquery.min.js

有谁知道如何解决这个问题?
(如果需要,我可以上传一些其他文件)

谢谢

0 个答案:

没有答案
相关问题