Reputation: 590
I have the following folder structure. I added mvc annotation and resources path but when I try call the resources in home.jsp
like <img src= "/resources/images/spitter_avatar.png" />
, it can't find anything.
Folder structure:
Here is my code in my servlet-config.xml file for resources:
<mvc:annotation-driven/>
<mvc:resources mapping="/resources/**" location="/resources/" />
Upvotes: 1
Views: 3907
Reputation: 29
resources
folder must be located inside the WebContent folder.${pageContext.request.contextPath}
before your items url on the jsp page. Example:${pageContext.request.contextPath}/resources/images/springlogo.svg
Upvotes: 0
Reputation: 1147
<img src= "resources/images/spitter_avatar.png" />
try above remove "/" before resources
Upvotes: 6
Reputation: 6108
if you wanted to start with / , then use JSTL C tag
<img src= "<c:url value="/resources/images/spitter_avatar.png"></c:url>" />
Upvotes: 1