load image from db

hello,i have an image (blob type) saved into db (hibernate) and do not know how i can load this image back into my jsf page to display the picture.Some ideas ?thanks
[193 byte] By [hamidagaa] at [2007-11-26 17:45:51]
# 1
Create the image file using the blob object and give the url of the image file in jsf...simple.......shanu
mshanua at 2007-7-9 0:14:00 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
This is nothing JSF-special. Just Google for "ImageServlet".
BalusCa at 2007-7-9 0:14:00 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3
hello mshanu,>Create the image file using the blob object and give the url of the image file in >jsf...simple.......Can you please be more verbose. How can I create the image file using blob object?Can you please deliver the code?thanks for your
hamidagaa at 2007-7-9 0:14:00 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4
if i goole for imageservlet i get only api, nothing sensible.but always thankful for replies!
hamidagaa at 2007-7-9 0:14:00 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5

1st hit is not the only one hit =) Just check 50 hits or so.

"imageservlet.java" might be a better keyword though.

But in fact it's simple:

1) store images as BLOB in DB

2) create a servlet which listens on, for example, /image

3) call it with for example h:graphicImage src="/image?id=1", /image/1, /image/blah, etc.

4) in this servlet get the BLOB as Inputstream and write it to the outputstream of the response.

BalusCa at 2007-7-9 0:14:00 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 6

would i be too impudent , if i asked you to deliver me the code for the 3 points ? :)

i've no idea how to do it.

2) create a servlet which listens on, for example, /image

3) call it with for example h:graphicImage src="/image?id=1", /image/1, /image/blah, etc.

4) in this servlet get the BLOB as Inputstream and write it to the outputstream of the response.

hamidagaa at 2007-7-9 0:14:00 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 7
Do a more specific Google search. Search on "imageservlet site:sun.com" (without the quotes btw).
BalusCa at 2007-7-9 0:14:00 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 8
Create the file using FileInputStream. Inject ur bytesreatm that u got from blob object to this streatm and name the file as .jpg (the original file name i mean). The file name shoulf be passed to src entry..regardsShanu
mshanua at 2007-7-9 0:14:00 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 9
Hi,check out this link , might be useful for you http://forum.java.sun.com/thread.jspa?threadID=750411&messageID=4290934cheers,Ram
gsrama at 2007-7-9 0:14:00 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...