From: "Braun, James F" <[EMAIL PROTECTED]>

Goal: Read a blob image from an Oracle database and render it on an html
page using the struts framework.

I have no trouble getting the image from the database. However, I wonder
if there isn't a better way to display it rather than writing it to a
physical file and then rendering it. I'm using the <html:img tag to
display the image now.

When the browser encounters an <img> tag, it makes a separate request to the server for the image. You can map that request to whatever you want-- I would use a Servlet-- and write the bytes of the image out to the browser.

I do this with JFreeChart to display a pie chart, but the basics are the same whether you read the image from a database or create it on the fly.

If you want to use an Action, (maybe you need some values from the form bean to figure out what image to load,) you can 'take over' the response, and then return null from the execute method to tell the framework that it doesn't need to do anything else with the response.

For images that don't change, there should be some sort of caching mechanism in place so you're not constantly going back to the database for the same image.

--
Wendy Smoak

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to