title: Display image (from database) in JSP
body: <p>I would like to know how to display an image in a JSP page within a for loop. The image is accessed from a database. Below is my code and i'd like the image to be exactly where the line <code>"&lt;img src="&lt;%= product.thumbnail %&gt;"/&gt;"</code> is.</p>
  
  <p>Short and simple chunk of my code:</p>
  
  <pre><code>&lt;%
      for(int i=0; i&lt;keys.length;i++){
          Product product = sdb.getProduct(keys[i].toString());
          out.println( "&lt;p&gt;" + product.title + "    " + "&lt;img src="&lt;%= product.thumbnail %&gt;"/&gt;" + "&lt;/p&gt;" );
      }
  %&gt;
  </code></pre>
  
  <p>Thanks</p>
  
  <p><strong>--Added after edit--</strong></p>
  
  <p>Generated HTML:</p>
  
  <pre><code>&lt;html&gt;
  
  &lt;body&gt;
  
  &lt;p&gt;Linez    99.99    1&lt;/p&gt;
  &lt;p&gt;Stax    49.99    3&lt;/p&gt;
  
  
  &lt;p&gt; Order total = 249.96
  
  
  &lt;form action="order.jsp" method="post"&gt;
    &lt;input type="text" name="name" size="20"&gt;
    &lt;input type="submit" value="Place Order" /&gt;
  &lt;/form&gt;
  
  &lt;form action="basket.jsp" method="get"&gt;
    &lt;input type="hidden" name="emptyBasket" value="yes"&gt;
    &lt;input type="submit" value="Empty Basket" /&gt;
  &lt;/form&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>