I have a Spring project:
Resource files are under : src/main/resources/style/………lots of subfolders
servlet.xml:
<mvc:annotation-driven/>
<mvc:resources mapping="/resources/**" location="/resources/" />
and my jsp:
<link rel="stylesheet" href="<%=request.getContextPath()%>/resources/style/jquery_ui/css/custom-theme/jquery-ui-1.8.23.custom.css"/>
When I browse to my view, gives this link as location:
http://localhost:8080/webapp/WEB-INF/classes/style/jquery_ui/css/custom-theme/jquery-ui-1.8.23.custom.css
How can I get it to show css file correctly?
The standard Maven layout has web resources located in
src/main/webapp/resources. Thesrc/main/resourcesis more for library and Java resources.Referencing them in your JSP is easily done with the JSTL core
c:urltag. You don’t need to worry about context root when using these. For example:The library will automatically prepend the context root to this URL.