I’m working on a Spring MVC 3 web application, I have some JSPs that works well with an exception, I’m having some problem displaying images -gif, jpeg and so on-. I tried these on the JSP side:
<img alt="TestDisplay" src="../images/XXX.gif" />
<img src="<c:url value=""/>images/XXX.gif" alt="TestDisplay"/>
<img src="<c:url value="/"/>images/XXX.gif" alt="TestDisplay"/>
<img src="<c:url value="../images/XXX.gif"/>" alt="TestDisplay"/>
<img src="<c:url value="/"/>WEB-INF/images/XXX.gif" alt="TestDisplay"/>
<img src="<c:url value="../WEB-INF/images/XXX.gif"/>" alt="TestDisplay"/>
<img src="<%=request.getContextPath()%>/images/XXX.gif" alt="TestDisplay" />
<img src="images/XXX.gif" alt="TestDisplay"/>
<img src="<spring:url value="/images/XXX.gif" htmlEscape="true" />" align="right" alt="TestDisplay"/>
But I’m not sure if the real problem comes from pages or anywhere. Any helpful answer will be rated.
Application Hierarchy Tree:
/webapp
//images
+XXX.gif
//WEB-INF
///images
+XXX.gif
Yes, I know images folder is duplicated, I’ve done it just to try any of the above options.
Thanks in advance
The correct usage is:
Files in
WEB-INFare not accessible to clients.