John, we have a similar process where by we allow a customer to download a file. Instead of the Struts handling the actual downloading, we direct the user to the informational page for the file. That page contains either javascript or a meta-refresh tag which redirects the request to the file to be downloaded. If found, the browser does the rest (displayes file save dialog box). The user can then download the file while on the informational page for that file. When they are done downloading the file, the dialog box goes away leaving them on that file's informational page.
HTH, robert > -----Original Message----- > From: John Moore [mailto:[EMAIL PROTECTED] > Sent: Tuesday, May 11, 2004 1:01 PM > To: Struts Mailing List > Subject: Forward after returning content? > > > I suppose what I am trying to do is impossible, but I just wanted to > make sure. I have a link where people can download a file, which is > handled by a DownloadAction. Below is the relevant code to download the > file, from the execute method. What I want to have happen is that, when > the file is downloaded, that they should be forwarded to a page > explaining what to do with the downloaded file. In my code here, that > would be dealt with by the last line. The problem is that it never > actually does get forwarded to the page, presumably because the request > is by this point deemed to have been fully dealt with (i.e., the > response has been returned). How should I go about doing this? > > res.setStatus(res.SC_OK); > res.setContentType("application/octet-stream"); > res.setHeader("Content-Disposition", "attachment; > filename=" + file.getName()); > res.setContentLength((int)file.length()); > BufferedOutputStream bos=new > BufferedOutputStream(res.getOutputStream()); > BufferedInputStream bis=new BufferedInputStream(new > FileInputStream(file)); > byte[] buf=new byte[32768];//do it in large chunks, > it's quicker > int bytesRead; > while((bytesRead=bis.read(buf,0,buf.length))!=-1) { > bos.write(buf,0,bytesRead); > } > bos.close(); > bis.close(); > saveInfo(downloadForm); //save the details in the > database > forward=mapping.findForward("success"); > > John > > ============================================= > John Moore - Norwich, UK - [EMAIL PROTECTED] > ============================================= > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]