The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
September 2000



This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.


Try this

Posted by Ram Kumar on April 09, 2001 at 5:15 AM

hey... try replacing this code ..

res.setHeader("Content-disposition", "attachment; filename=" + "Banu" + ".txt");


res.setContentType("application/zip" name=" + "Banu.txt" +
"\nContent-Disposition: attachment; filename=" + "Banu.txt" + "\n\n");

I think it works..

Ram Kumar

> Hi,

> I have a small problem........We are using Jsps in our application. On click of the save button in the jsp, it submits the form which calls a servlet. The servlet retrieves data from the database and writes it into the ServletOutputStream. To save the data in a file, the following two lines have been added :

> res.setContentType("application/zip");
> res.setHeader("Content-disposition", "attachment; filename=" + "Banu" + ".txt");
> ServletOutputStream out1 = res.getOutputStream();
> out1.print();

> In both NE & IE 5.0, it is saving the file properly. It is also allowing to click the save button again. But in IE5.5, after saving the file, if the save button is clicked the second time, it gives a strange error that " Access is denied".

> How to we avert this ?

> Regards,
> Banu


Sponsored Links

Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us