Try zos.flush() instead of close()
It is not your responsibility to close the servlet output stream, it is the
container's.
2008/10/13 Ariel <[EMAIL PROTECTED]>
> Hi Everybody:
> I 'm using struts 1.2 version, in my web application I have a chart where
> the user can add several files that are located in the server, then in a
> hiperlink the user decide to download the several files in a zip file. I
> implemented this functionalities, in Mozilla Firefox works perfectly but
> with Internet Explorer doesn't work.
> Please could you help to find how to do it correctly to make it works in
> both browsers ???
> Here I post a piece of my code:
> <Code>
> ServletContext context =
> getServlet().getServletContext();
> String mimetype =
> context.getMimeType(filename);
> resp.setContentType( (mimetype != null) ? mimetype
> :"multipart/mixed" );
> resp.setHeader( "Content-Disposition", "attachement;
> filename=\"chart.zip\"" );
> ZipOutputStream zos = new
> ZipOutputStream(resp.getOutputStream());
> ChartStructure chart = (ChartStructure)
> req.getSession().getAttribute("chart");
> byte[] buf = new byte[1024];
> int len;
> for (Iterator<Files> iterator = chart.iterator();
> iterator.hasNext();){
> Files elem = iterator.next();
> ZipEntry zipEntry = new
> ZipEntry(elem.getPhisicalFileName());
> String filepath = elem.getDownloadLink();
> FileInputStream fin = new FileInputStream(path);
> BufferedInputStream in = new BufferedInputStream(fin);
> zos.putNextEntry(zipEntry);
> while ((len = in.read(buf)) >= 0) {
> zos.write(buf, 0, len);
> }
> in.close();
> zos.closeEntry();
> }
> zos.close();
> </Code>
>
> I hope you can help me.
> Greetings
> Ariel
>