Hi, I'm trying to code file download functionality in a Struts 2 action. The action executes and the "success" result is invoked, but the pop-up window in the browser, which prompts to save the file, does not appear.
I think I am configuring the response incorrectly (see code below). Any help greatly appreciated. Thanks, John My action code is as follows :- File file = new File(downloadDirectory + filename); FileInputStream fis = new FileInputStream(file); BufferedInputStream bis = new BufferedInputStream(fis); HttpServletResponse response = ServletActionContext.getResponse(); response.setContentType("application/msword"); response.setHeader("Content-disposition", "attachment; filename=" + filename); OutputStream output = response.getOutputStream(); byte[] buffer = new byte[4096]; int count = 0; int n = 0; while (-1 != (n = bis.read(buffer))) { output.write(buffer, 0, n); count += n; } bis.close(); fis.close(); -- View this message in context: http://www.nabble.com/Problem-downloading-a-file-using-a-Struts-2-action-tf3981397.html#a11302604 Sent from the Struts - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]