Not sure what is wrong, but for a possible work-around, have you tried
making the target for the form (or link) a new window?

Daniel.


> -----Original Message-----
> From: Eric Hodges [mailto:[EMAIL PROTECTED]
> Sent: 27 August 2004 17:17
> To: Struts Users Mailing List (E-mail)
> Subject: Question about downloading files from a Struts servlet
>
>
> I have a Struts form and action that downloads a file to the client.  The
> servlet code looks like this:
>
>   response.reset();
>   AdminSetupForm setupForm = (AdminSetupForm) form;
>   response.setContentType("application/download");  // also tried
> "application/octet-stream", "junk/xml", etc.
>   response.addHeader("Content-disposition", "attachment;
> filename=setup.xml"); // also tried other file names and
> attachment with no
> file name
>   ServletOutputStream out = response.getOutputStream();
>   String exportFile = <generate file contents as a string here>
>   response.setContentLength(exportFile.length());
>   out.write(exportFile.getBytes());
>   out.flush();
>   out.close();
>
> This downloads the file properly, but on IE 6.x it corrupts the
> DOM Document
> on the browser.  The form is submitted from JavaScript and all of the
> buttons on the form invoke JavaScript functions.  After
> downloading the file
> on IE 6.x, any attempt by JavaScript to reference the "document" object
> causes an "Unspecified Error".  Inspecting the JavaScript
> environment with a
> script debugger shows that "document" is no longer an object.
>
> I can't find anyone else having this problem, and I've tried many
> different
> ways to solve it.  If anyone has experience with this, please let me know
> what you did.
>
> Thanks,
> Eric Hodges
>
>
> ---------------------------------------------------------------------
> 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