I have an error including static resources in my spring mvc project.
My css is in /webapp/resources/css
.
I have the following lines in my spring dispatcher servlet:
<mvc:resources mapping="/webjars/**" location="classpath:/META-INF/resources/webjars/"/>
<mvc:resources mapping="/resources/**" location="/resources/" />
I include it in my jsp file like this:
<link href="<c:url value="/resources/css/mycompany.css" />" rel="stylesheet">
The problem is that it's working only if my URL is like:
http://localhost:8080/MyProject/firstLevel
But if my URL is like this it's not working:
http://localhost:8080/MyProject/firstLevel/secondLevel
If I open the console I can see an error:
"Failed to load resource: the server responded with a status of 404"
in http://localhost:8080/MyProject/firstLevel/webjars/jquery/2.1.4/jquery.min.js
Because I think it has to find it in:
http://localhost:8080/MyProject/webjars/jquery/2.1.4/jquery.min.js
Does anyone know how to solve this issue?
(I can upload some other files if needed)
Thank you