I think you're thinking about this the wrong way round. Tags run on
the server to generate HTML content - so all the <html:img> tag does
is render the html markup of <img src="...."> - its then the browsers
job to download the image referenced in the "src" attribute.

So what you need is to specify a url in that src attribute which will
run something on the server to get your image from the database and
return the image's content as the response. You can do that with a
Struts action - retrieve the image, write it out as the response and
return "null" (rather than an action forward) - setting the
appropriate content stuff.

There is a "download action" which is designed to make this kind of
thing easier (Ithink it was introduced in Struts 1.2.4), details here:

http://wiki.apache.org/struts/StrutsFileDownload

Niall

On 1/24/06, Gary Feidt <[EMAIL PROTECTED]> wrote:
> Hi Everybody,
>
> I'm using Struts 1.2.4, with no frills (JSTL, Struts EL) - just using
> Struts framework and tags.
>
> I am exploring the ability to display images from database - never done
> this before.  I'm guessing I can get the data out by using the
> java.sql.getBinaryStream
>
> Will the <html:img> tag display a java.io.InputStream, or is there a
> better way?
>
> Thanks,
>
> Gary

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

Reply via email to