Reputation: 626
So I am currently working on a Spring-project in Intellij. In my JSP-view I have both JQuery, Bootstrap and some local css/js-files.
When I work on the pure HTML in WEBSTORM the paths are easy to interpreter as they just are relative. As far as I understand the paths in Spring are defined in a XML-file and everything goes from there.
My mvc-dispatcher-servlet.xml has this:
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/pages/"/>
<property name="suffix" value=".jsp"/>
</bean>
And my files are organized like this:
WEB-INF
css
js
How do i find the path? Have google like a hero and tried a lot but the files are not found Are there other files that rules over the path-hierarchy?:(:(
Example:
<script src="relative-path/js/bootstrap.min.js"></script>
<link rel="stylesheet" type="text/css" href="relative-path/css/login.css">
Upvotes: 0
Views: 1280
Reputation: 10017
Assuming you are using maven:
src/main
java
resources
webapp
Then the config..
<mvc:resources mapping="/static/**" location="/static/"/>
then you can use /css/main.css
, something like this to access your resources in jsp
But there are different options out there, I will suggest you to read the document
Upvotes: 1