Hi All,

I have a database table "productdetails",where i have id,name,price,prodimage(blob) fields.

Am displaying all the records using jsp inside a div with the help of while loop, am getting all the datas correctly except the image.

Check below code and let me know how to display the image retrieved from databse inside a img tag.

<%
rs = s.executeQuery("select * from productdetails"); 
while(rs.next())
{
%>
<div><%=rs.getString("id")%>
<div><%=rs.getString("name")%>
<div><%=rs.getString("price")%>
<img src="<%=rs.getString("prodimage")%>" />
}

1. BAD thing what you just showed as database connectivity, you shouldn't do it from page view
2. Of course it will not work, because what you getting from database is blob object and not ready to display image. You need to convert blob to something that browser will understand

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.