One other thing to keep in mind is if your file being generated every
request, you might want to have your file name and request to the file have
a randomly generated part of the request, otherwise there might be browser
caching issues:

/getFile.do?id=4432423&random=<%=System.currentTimeMillis()%>

You can do the same for the Content-Disposition filename attribute.

-Jacob Hookom

-----Original Message-----
From: Hookom, Jacob [mailto:[EMAIL PROTECTED] 
Sent: Thursday, December 04, 2003 9:04 AM
To: Struts Users Mailing List
Subject: [OT] RE: File Download?

This is what we use for file downloads (Excel/PDF files).

String contentType = this.beanWriter.getContentType();
response.setContentType(contentType);
response.setHeader("Content-Disposition","attachment;filename=\""
        + this.beanWriter.getFileName(request) + "\"");

And have your struts action return null.

-Jacob

-----Original Message-----
From: Jerry Jalenak [mailto:[EMAIL PROTECTED] 
Sent: Thursday, December 04, 2003 9:05 AM
To: '[EMAIL PROTECTED]'
Subject: File Download?

I have a need to send generated image files from my web server to a file
stored on a users local hard drive - ie file download.  I've been googling
now for awhile and haven't really found anything (maybe my search criteria
is wrong).  Does anyone have any pointers on the best way to do this?

Thanks!

Jerry Jalenak
Development Manager, Web Publishing
LabOne, Inc.
10101 Renner Blvd.
Lenexa, KS  66219
(913) 577-1496

[EMAIL PROTECTED]


This transmission (and any information attached to it) may be confidential
and
is intended solely for the use of the individual or entity to which it is
addressed. If you are not the intended recipient or the person responsible
for
delivering the transmission to the intended recipient, be advised that you
have received this transmission in error and that any use, dissemination,
forwarding, printing, or copying of this information is strictly prohibited.
If you have received this transmission in error, please immediately notify
LabOne at the following email address: [EMAIL PROTECTED]


---------------------------------------------------------------------
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]

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

Reply via email to