Unable to download close Pop up Window on Struts Framework
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Anonymous
Posted On:   Tuesday, January 18, 2005 05:49 AM

Hi, Our Application is built on Struts Framework. I am trying to download a file on our application using the following code given below. When i try to download the file, i get the Pop-up window asking either to open the file or save the file to the disk. Instead of downloading , if i click "Cancel Button" on the pop-up window , the window gets closed, but when i try to click on any other link on the application, the download popup window again appears.The pop-up window is not displayed only when i click on the Reload button of the browser. Any Help is greatly appreciated. This is the code that I am using for DownLoading a File. re   More>>

Hi,


Our Application is built on Struts Framework. I am trying to download a file on our application using the following code given below. When i try to download the file, i get the Pop-up window asking either to open the file or save the file to the disk. Instead of downloading , if i click "Cancel Button" on the pop-up window , the window gets closed, but when i try to click on any other link on the application, the download popup window again appears.The pop-up window is not displayed only when i click on the Reload button of the browser.


Any Help is greatly appreciated.








This is the code that I am using for DownLoading a File.




response.setContentType("application/x-download");

response.setHeader("Content-Disposition", "attachment; filename="" + sFileName +"");

response.setContentLength(iFileLength);

OutputStream outStream=null;

outStream = response.getOutputStream();

this.copyStream(outStream, byteArray);

outStream.flush();

outStream.close();

}//end downloadFile
//-------------------------------------------------------------------


private void copyStream(OutputStream out, byte[] buffer) throws IOException{

out.write(buffer) ;

}//end copyStream




Thanks

   <<Less
About | Sitemap | Contact