This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
shyamkumar bopannachengalaiah wrote:i need to display a set of images randomly by retreiving the images from database.I need code for it .I have to display in particular table in my webapplication.
JSP outputs HTML.
In HTML, images are represented by the <img> tag.
In <img>, the 'src' attribute should point to a valid URL of an image stream.
A valid URL of an image stream can be either a static image, or a dynamic image.
A dynamic image can be served by a servlet which takes a parameter representing the image ID, reads the image from the DB as an InputStream and writes it to the OutputStream of the response.
If you need public code, just Google the smart way. "ImageServlet" or so.