title: Not allowed to load local resource in spring mvc
body: <p>In my <code>spring mvc</code> project i m having a issue about loading image to <code>client side</code>.
  the <code>console</code> showing <strong>Not allowed to load local resource</strong>
  I have figured out, that i need to create image <code>servlet</code> for viewing image.
  but when i running the application no image showing..how can i solve this problems...</p>
  
  <p><strong><code>servlet</code> configuration in web.xml</strong></p>
  
  <pre><code>&lt;servlet&gt; 
      &lt;servlet-name&gt;studentServlet&lt;/servlet-name&gt;
       &lt;servlet-class&gt;com.bbs.response.web.controller.utils.StudentImageServlet&lt;/servlet-class&gt;
        &lt;/servlet&gt;   
        &lt;servlet-mapping&gt;
         &lt;servlet-name&gt;studentServlet&lt;/servlet-name&gt; 
         &lt;url-pattern&gt;/students/&lt;/url-pattern&gt;
          &lt;/servlet-mapping&gt; 
  </code></pre>
  
  <p><strong>image view servlet</strong></p>
  
  <pre><code>public class StudentImageServlet extends HttpServlet {
      private static final long serialVersionUID = 1L;
  
      public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
      String urlImage = request.getParameter("student"); 
      System.out.println("urlImage---"+urlImage);
          response.setContentType("image/jpeg");
          ServletOutputStream out;
          out = response.getOutputStream();
          FileInputStream fin = new FileInputStream("C:/jboss/welcome-content/students/"+urlImage);
  
          BufferedInputStream bin = new BufferedInputStream(fin);
          BufferedOutputStream bout = new BufferedOutputStream(out);
          int ch = 0;
          while ((ch = bin.read()) != -1) {
              bout.write(ch);
          }
  
          bin.close();
          fin.close();
          bout.close();
          out.close();
      }
  }
  </code></pre>
  
  <p><strong>my jquery script for viewing image</strong></p>
  
  <pre><code>&lt;img style="height:50px; width:50px" name="student" src="C:/jboss/welcome-content/students/'+ studentBasic.photo+ '" /&gt;
  </code></pre>