RE: Downloading file rendered in JSP

2008-04-08 Thread Brad A Cupit
Mailing List Subject: RE: Downloading file rendered in JSP Thanks for that. I actually just needed to implement the ServletResponseAware interface to access the servlet response properly. Trying to set those in the JSP (through a scriplet) didn't work, but indeed doing it in the action is

RE: Downloading file rendered in JSP

2008-04-08 Thread David Loup
ailto:[EMAIL PROTECTED] Sent: 08 April 2008 14:25 To: Struts Users Mailing List Subject: RE: Downloading file rendered in JSP To set the download file name, in addition to the "text/csv" mime type (which you already have set), write the following java code in your Action or (if necessary)

RE: Downloading file rendered in JSP

2008-04-08 Thread Brad A Cupit
To set the download file name, in addition to the "text/csv" mime type (which you already have set), write the following java code in your Action or (if necessary) as Java in your JSP: response.setHeader("Content-disposition", "attachment; filename=" + CSV_FILE_NAME); where CSV_FILE_NAME is the n

Re: Downloading file

2006-11-03 Thread Balwinder
Mike Baroukh wrote: You must use content-disposition header : response.setHeader("Content-Disposition", "attachment; filename=\""+myfilename+"\""); You can also add a mime type with something like String mimeType = getServletContext().getMimeType(myfilename); response.setHeader("Content-Ty

Re: Downloading file

2006-11-03 Thread Puneet Lakhina
On 11/3/06, Balwinder <[EMAIL PROTECTED]> wrote: Hi All, I am developing an application in struts in which I needed to download a file from a server. When iam clicking on download button, file lose its extension and it with the action ie .do and does not open with the associated application.

Re: Downloading file

2006-11-03 Thread Niall Pemberton
On 11/3/06, Balwinder <[EMAIL PROTECTED]> wrote: Hi All, I am developing an application in struts in which I needed to download a file from a server. When iam clicking on download button, file lose its extension and it with the action ie .do and does not open with the associated application. A

Re: Downloading file

2006-11-03 Thread Mike Baroukh
You must use content-disposition header : response.setHeader("Content-Disposition", "attachment; filename=\""+myfilename+"\""); You can also add a mime type with something like String mimeType = getServletContext().getMimeType(myfilename); response.setHeader("Content-Type", mimeType==null?"