I am storing jpg image in Mysql database and then retrieve it back from database table and displaying in jsp page. My table structure for that is very simple and as followed.
table column 'id' int(5) auto generate and primary key.
table column 'image' blob Notnull.
i use following code to display image in jsp page and its working fine.
This code is working properly, but my problem is, by using this code i can display only one image on one jsp page. I want to display image inside div tag. So i can keep multiple div tags on one page having different images and keep information about image in another div tag.
If anybody know any solution then please help me.....
JSP is merely a templating technology to create HTML to send to the browser. So given that the end result is HTML, then the answer to "How do I show an image in JSP?" is exactly the same as "How do I show an image in HTML?"
The answer, of course, is with an image tag.
So all that Java code in your JSP is useless -- and shouldn't be there anyway, see this JspFaq entry -- at least in the JSP. What you need is a servlet that sends the image data as a response that the image tag can use as its source.
See this article for an explanation of what JSP is and how it works.