You don't really need to upgrade to 1.2.6, all you need to do is take the
DownloadAction class (and the ResourceStreamInfo class IIRC) from 1.2.6
and use it.  There's nothing that I recall that would make it not work in
previos versions of Struts.

I have an app that downloads images from a database, and while I wrote a
separate servlet to do it because of some security setup I had to provide
for, the code is extremely similar to the DownloadAction... what your
trying to do is in no way unusual, and anyone that has done it will have
similar-looking code :)

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
AIM: fzammetti
Yahoo: fzammetti
MSN: [EMAIL PROTECTED]

On Tue, January 24, 2006 10:31 am, Gary Feidt said:
> Your example is using Struts 1.2.6.  Maybe I can upgrade, but I don't
> think so right now.  I guess I was thinking of it in the wrong way as
> you stated, but I sure did not think it would be difficult to display an
> image stored in a database on a web page.
>
> If anyone else has a work around that they are using in Struts 1.2.4 I
> would apprehiate the help.  I do have a DAO layer that is getting my
> data from the database, Actions and Forms to load this into.
>
> Thanks,
>
> Gary
>
>>>> [EMAIL PROTECTED] 1/24/2006 9:07:35 AM >>>
> 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]
> __________________________________
>
> Confidentiality Statement:
> This email/fax, including attachments, may include confidential and/or
> proprietary information and may be used only by the person or entity to
> which it is addressed. If the reader of this email/fax is not the intended
> recipient or his or her agent, the reader is hereby notified that any
> dissemination, distribution or copying of this email/fax is prohibited. If
> you have received this email/fax in error, please notify the sender by
> replying to this message and deleting this email or destroying this
> facsimile immediately.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


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

Reply via email to