This week's book giveaway is in the OCAJP forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line!
See this thread for details.
The moose likes JSP and the fly likes pictures in a jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA Java SE 8 Programmer I Study Guide 1Z0-808 this week in the OCAJP forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "pictures in a jsp" Watch "pictures in a jsp" New topic
Author

pictures in a jsp

siddharth das
Ranch Hand

Joined: Aug 17, 2007
Posts: 125
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

Joined: Dec 11, 2004
Posts: 13410

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.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: pictures in a jsp