Display image in JSP with SPRING MVC

To avoid to have to indicate explicitly the context path you can use jstl core and do it like that

<img src="<c:url value="/images/logo.jpg"/>"/>

You can also check this thread about spring ressource and path

Spring 3 MVC resources and tag <mvc:resources />


Any static resource is also look for a URL Mapping in spring mvc, so static resources should be defined in the springmvc-servlet.xml.

Add the following entry to your MVC configuration. I assume that your static files in resources folder.

<mvc:resources mapping="/resources/**" location="/resources/" />

then static files can be accessible from the page.

<img src="/resources/images/logo.jpg" />