• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

retrieve multiple images from mysql

 
shyamkumar bopannachengalaiah
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65216
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JavaRanch is not the place to come and get others to write your code for you. You will get lots of help with your code, but you have to put in the work. Please read this for more information.

Basically, you need to put tags on your pages that reference resources (servlets perhaps, but not JSPs) that will serve the image data.
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic