0

This is probably some simple little thing I'm doing wrong, but I'll ask anyway. I have several images that aren't showing up in my JSP. My images are stored at WEB-INF/pages/images. Here is a sample of how I'm referring to them in my JSP.

<img src="images/guestbook.jpg" alt="Guest Book" />

I'm also getting this error in my console.

WARNING: No mapping found for HTTP request with URI [/ghs1986/images/guestbook.jpg] in DispatcherServlet with name 'ghs1986'
  • your answer may be here : http://stackoverflow.com/questions/9215014/jawr-spring-images-not-found-am-i-missing-something – asyard Apr 21 '13 at 08:08

2 Answers2

3

In your spring-config.xml, add:

<mvc:resources location="/images/" mapping="/images/**" />
Arjun Rao
  • 677
  • 4
  • 15
  • This removed the warning, but there are still no images in my browser screen. –  Apr 21 '13 at 05:47
  • I changed the location to WEB-INF/pages/images/, and that was what finally worked. Thanks to everyone for your help. –  Apr 21 '13 at 21:47
1

Check your image folder path & try using application context while pointing to your images. Try using ${pageContext.request.contextPath}.

for e.g

<img src="${pageContext.request.contextPath}/images/guestbook.jpg" alt="Guest Book" />

Change this as per your path / needs.

Jeevan Patil
  • 6,029
  • 3
  • 33
  • 50