I am using struts action class to download a file .
  
  
  Here is the action class 
  
  
      public ActionForward execute(ActionMapping aActionMapping, ActionForm 
aActionForm,
               HttpServletRequest aHttpServletRequest, HttpServletResponse  
aHttpServletResponse)
              throws Exception {
          String aFileName=aHttpServletRequest.getParameter(IWeb.FILE_NAME);
          aHttpServletResponse.setContentType("application/octet-stream");
          
          Integer aSysAttachId = new 
Integer(aHttpServletRequest.getParameter(IWeb.SYS_ATTACH_ID));
           aHttpServletResponse.setHeader("Content-Disposition",  "attachment; 
filename=\"" +aFileName+ "\"");
           
download(aApplicationInfoDelegate.getApplicationAttachemntFile(aSysAttachId),aHttpServletResponse);
          return null;
      }
  
      private void download(byte[] byteArray, HttpServletResponse 
httpServletResponse)
              throws IOException, SQLException {
          try {
               BufferedOutputStream aBufferedOutputStream =new  
BufferedOutputStream(httpServletResponse.getOutputStream());
              aBufferedOutputStream.write(byteArray,0,byteArray.length);
              aBufferedOutputStream.close();
          } catch (Exception e) {
              throw new IllegalArgumentException(e.getMessage());
          }
      }
  
  
  
  download works  in mozilla but  in internet explorer   when user chooses to 
open  the downloaded file (a pdf) rather than  saving  IE opens Adobe Acrobat 
reader 
  with an error message "There was an error opening this document .This file 
cannot be found."
  
  Can somebody guide me what is going wrong  here ?
  Thanks & Regards
  
  

                
---------------------------------
Yahoo! Photos – Showcase holiday pictures in hardcover
 Photo Books. You design it and we’ll bind it!

Reply via email to