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.
kavin clain wrote:I want to show images which are saved in database.
No problem. Just write a servlet that streams the data from the DB and sets the appropriate response headers. Then you can reference the servlet from anywhere that you can reference an image (<img> tag, CSS, etc)
I am sending request using ajax.
Problem. Why are using Ajax to fetch an image? What would you do with it?
Where ImageStreamer is your servlet/action/whatever and 23 is the ID of the image to fetch from the database. Then stream the bytes of the file (not a java.awt.Image object) back to the client.