I’m having some problems with the tag (Spring 3.0.5).
I want to add images to my web application, but it doesnt work.
Here is part of my beans config:
<mvc:annotation-driven/>
<mvc:default-servlet-handler default-servlet-name="ideafactory"/>
<mvc:resources mapping="/resources/**" location="/, classpath:/WEB-INF/public-resources/" cache-period="10000" />
Trying to add an image in a jsp file:
<img src="<c:url value="/resources/logo.png" />" alt="Idea Factory" />
First of all, I don’t know really where to store the resources (src/main/resources/public-resources? src/main/webapp/WEB-INF/public-resources?).
Secondly, this config does not work, I can’t see the image. What’s wrong?
Thanks!
EDIT: the solution given here: Spring Tomcat and static resources and mvc:resources doesn’t work either…
Added without success.
EDIT 2: I tried to remove the mvc:resource tag and let only the mvc:default-servlet-handler> one, gave me infinite loop and stackoverflow… o_O (Serving static content with Spring 3)
Found the error:
Final xxx-servlet.xml config:
Image in src/webapp/resources/logo.png
Works!