title: Loading image file in JSP
body: <p>I have code as follows:</p>
  
  <pre><code>&lt;td width="24px"&gt;
      &lt;img src="${pageContext.request.contextPath}/images/success.gif"/&gt;
  &lt;/td&gt;
  </code></pre>
  
  <p>My gif file is located at location </p>
  
  <blockquote>
    <p>\src\main\webapp\images</p>
  </blockquote>
  
  <p>It doesn't load the images when I try to load it by using Spring MVC framework.</p>
  
  <p>I tried by giving the path </p>
  
  <pre><code>&lt;img src="images/success.gif/"&gt;
  
  &lt;img src="webapp/images/success.gif/"&gt;
  </code></pre>
  
  <p>View Source gives:</p>
  
  <pre><code> &lt;img src="/MyProject-UX/images/success.gif"&gt;
  </code></pre>
  
  <p>My spring config file:</p>
  
  <pre><code>&lt;context:component-scan base-package="com.mycompany"/&gt;  
  &lt;mvc:annotation-driven /&gt;
  &lt;bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"&gt;
         &lt;property name="prefix" value="/WEB-INF/view/"/&gt;
         &lt;property name="suffix" value=".jsp"/&gt;
  &lt;/bean&gt;
  
  @Controller    
  @RequestMapping("/closeWindow")
  public class ClosingWindow {
     @RequestMapping(method = RequestMethod.GET)
     public String printHello(ModelMap model) {     
         return "closeWindow";
     }
  </code></pre>
  
  <p>I have followed guide here <a href="https://stackoverflow.com/questions/17628945/load-an-img-in-a-jsp">Link-1</a> <a href="https://stackoverflow.com/questions/9134148/img-is-not-working-in-jsp/9134267#9134267">Link-2</a></p>