David Mossakowski wrote:
>
> I have similar problem. I have images stored in a database and I need to put
> them into a jsp page.
>
> Would it be possible to store Image object in a bean and have the jsp display
> it? I gues a simple answer to that question is no since jsp's DISPLAY tag
> displays string only.
>
> Any thoughts on this? This seems like a showstopper to me as far as using JSP
> for my application. I can't create temporary image files 'cause that's too
> messy to deal with. I would have to delete the files after viewing, give them
> unique names etc.
No. Please no. Storing an image in a DB for retrieval via a web server
is, well, just stooooopid. Here's why:
You are running a web server. Its job is normally to serve FILES. It
handles
images, being files, very well, thank-you-very-much.
If you have to pull them out of your database every time, you have to:
open a connection
fiddle with the output mime types
push the image out
etc
on top of the time it takes to make the HTTP call.
I have the same situation in my project I'm doing at present - I have a
table
of brands with brand images as BLOB fields - there will be about 80
brands,
and on one page I have to retrieve them all so the user can select by
brand. If I get this out of a DB, it would take about 81 hits on the DB
to get,
which is NEVER going to be as quick as 1 hit on the DB and 80 hits on
the file system.
Imagine what happens if you use the JDBC->ODBC bridge and the ODBC
driver is not multi-threadable!
So please, pretty please, DONT DO IT! Write a thread on the server or
something that, periodically, grabs all the images and puts them in a
designated directory based on their PK, and then refer to them. I almost
guarantee your speed will be at least 5x greater with this method. Make
the thread do less by having a "last updated" field or something.....?
Yours pleadingly.
Nic.
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JSP-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".