I don't believe you can (although I would be interested if there was a way).
How about doing it the other way round, forward to your page with the
instructions on and use the meta refresh tag to redirect to your download
action. Something like this:

<html>
  <head>
      <title>Download Page</title>
      <meta http-equiv="refresh" content="0;
URL='myContext/myFileDownload.do'">
  </head>
  <body>

     <p>If download does not start with 30 seconds click <a
href="'myContext/myFileDownload.do'">HERE</a></p>

     <h1>Instructions</h1>

     <p>When the download has completed then.....</p>


 </body>
</html>



----- Original Message ----- 
From: "John Moore" <[EMAIL PROTECTED]>
To: "Struts Mailing List" <[EMAIL PROTECTED]>
Sent: Tuesday, May 11, 2004 6:01 PM
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]

Reply via email to