Thanks for responding.

>From you action after setting the headers and I assume you also >write the Zip 
>file contents to the OutputStream how are you going >back to the JSP. 

Yes, i do the following:

response.setContentType("application/zip");
response.setHeader("Content-Disposition", "attachment; filename=" + 
zipFileName);
response.setContentLength((int)tempCSVFile.length());
BufferedInputStream bufferedInput = new BufferedInputStream(new 
FileInputStream(tempCSVFile));
BufferedOutputStream bufferedOutput = new 
BufferedOutputStream(response.getOutputStream());
          
while((leftToRead = bufferedInput.read(buffer)) != -1) {
      bufferedOutput.write(buffer, 0, leftToRead);
}
          
bufferedInput.close();
bufferedOutput.flush();
bufferedOutput.close();

if(!errors.isEmpty()) {
      saveErrors(request, errors);
      return(mapping.findForward("fail"));
}

return (mapping.findForward("success"));

I create errors earlier in the class, for example:
error = new ActionError("error.ExportAction.domainError");
errors.add("exportDomainError", error);

The errors get output to my jsp file if i have the code related to sending the 
zip file commented out.  When it isn't comment the file gets sent back properly 
but i get no errors sent back to the jsp.  Is this normal for struts?

>I guess what you might want to do is that from a jsp, when the >user clicks on 
>the download link go to an action, which composes >the errors and takes the 
>user to another page which shows the >errors (if any) and sends a request for 
>the file to be downloaded >through <META> tags.

I was thinking of doing something like this, but was hoping i didn't have to.  
Can anyone confirm that i can't send both ActionErrors(or ActionMessags) and a 
file back to the client?

Jon.


-------------------------------------------------------------
<a href="http://Struts_User_List.roomity.com";>roomity.com</a>
Your Roomity Broadband Webapp ~~1129238460128~~
-------------------------------------------------------------

Reply via email to