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 "<img src="<%= product.thumbnail %>"/>"
is.
Short and simple chunk of my code:
<%
for(int i=0; i<keys.length;i++){
Product product = sdb.getProduct(keys[i].toString());
out.println( "<p>" + product.title + " " + "<img src="<%= product.thumbnail %>"/>" + "</p>" );
}
%>
Thanks
--Added after edit--
Generated HTML:
<html>
<body>
<p>Linez 99.99 1</p>
<p>Stax 49.99 3</p>
<p> Order total = 249.96
<form action="order.jsp" method="post">
<input type="text" name="name" size="20">
<input type="submit" value="Place Order" />
</form>
<form action="basket.jsp" method="get">
<input type="hidden" name="emptyBasket" value="yes">
<input type="submit" value="Empty Basket" />
</form>
</body>
</html>