struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Graf-Waczenski <...@lsoft.com>
Subject Re: Fwd: export file data using formFile
Date Mon, 15 Dec 2008 14:19:33 GMT
Here's an example:

public class Downloader extends HttpServlet
{
 private void doGet(HttpServletRequest req, HttpServletResponse resp) 
throws IOException
 {
        resp.setHeader("Pragma", "no-cache");
        resp.setHeader("Cache-control", "no-cache");
        resp.setIntHeader("Expires", -1);
        MyData data = new MyData();
        resp.setHeader("content-type", "application/pdf");
        resp.setHeader("content-encoding", "binary");
        resp.setHeader("Content-Disposition", "attachment; 
filename=myfile.pdf");
        data.writePDFDataToOutputStream(resp.getOutputStream());
}
}


elyes sallem wrote:
> ok, do you have an example?
>
> Thanks
> Regards
> Elyes
>
>
> 2008/12/15 Dave Newton <newton.dave@yahoo.com>
>
>   
>> --- On Mon, 12/15/08, elyes sallem wrote:
>>     
>>> the problem is that with the html:file you must browse to an
>>> existant file, but in my case, i wanna browse to a new file,
>>> and then in the action i will make some treatment, generate
>>> data and export them to this file
>>>       
>> That's not how you do that.
>>
>> You stream the response back and the user gets a save-file dialog.
>>
>> Dave
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>>     
>
>
>   


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message