title: How to print the correct path to resource when using out.print for HTML
body: <p>I am new to java, and am trying to add an image 'space.gif' from a file path through a html servlet.</p>
  
  <pre><code>public void doGet(HttpServletRequest request, HttpServletResponse response)
              throws ServletException, IOException
  {              
    response.setContentType("text/html");
  
    PrintWriter out = response.getWriter();
  
    out.print("&lt;HTML&gt;");
    out.print("&lt;HEAD&gt;&lt;TITLE&gt;Upload Image&lt;/TITLE&gt;&lt;/HEAD&gt;");
    out.print("&lt;BODY&gt;");
  
    out.print("&lt;img src='space.gif' alt='image' /&gt;");
  
    out.print("&lt;/BODY&gt;");
    out.print("&lt;/HTML&gt;");
    out.close();
  }
  </code></pre>