mercredi 6 mai 2015

I have stored a image in mysql and now i am trying to show that image in jsp page [duplicate]

I have Stored a Image in mysql giving data type Blob By using this lines

FileInputStream fin=new FileInputStream(Path);  

prepstatement.setBinaryStream(1,fin,fin.available()); 

prepstatement.executeUpdate();

Now when i am trying to retrieve the image in jsp page i am using this code:

<%

while(res.next())

{

%>

<img  src="<%=res.getBlob("photo")%>"> //photo name of column in mysql

<%

}//while

%>

It is not working. I am trying to retrieve the image from MySQL and then show that image in JSP <img> tag.

Aucun commentaire:

Enregistrer un commentaire