Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

pictures in a jsp

 
siddharth das
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
i need some idea.
i hava a database with a table.
that table contain two columns,name and picture(gif).
the table is updated daily i.e it contains 'n' number of pictures.
i have to display these pictures in a jsp.
but i have a condition that at a time i display 4 pictures.
so i have to keep page number in the bottom of the page(that is dynamically created according to number of pictures)to display all the pictures.
so how i will do.
please give some idea.
thank you.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would start by making a servlet that can stream binary data to a browser.
Have it accept an ID for the image in your database as a form parameter, querystring variable, or part of the URL.

Then write an object that can pull the image data from the database and return it to your servlet for streaming.

Note: Don't try to stream binary data from a JSP.
JSP wasn't meant to do that sort of thing and you'll save yourself a lot of headaches if you start out building it as a servlet.

I have a sample app that covers some of what you'll need to do.
http://simple.souther.us
Look for SimpleStream.

It reads the images from file but it wouldn't be difficult to modify it to read from a database instead.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic