Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Reload page after download

843842Sep 7 2008 — edited Sep 14 2008
Hello,
I'm trying to write a download servlet that also refreshes the original JSP. When the user hits download, I show a download-in-progress graphic, so after the download is generated and the user is prompted to save the file, I want the JSP to refresh to remove the "loading" graphic.

I'm using:
        response.setContentType("application/vnd.ms-excel");
        response.setHeader("Content-Disposition", "attachment; filename=\"myfile.xls\"");
        
        OutputStream out = response.getOutputStream();
        writeSpreadSheet(out);
        out.flush();
        out.close();
However, once I flush i can't send back a redirection or refresh header.

Can anyone suggest of a way to do this? Maybe I can use javascript to detect when the download is returned and put the other image back?

Maybe there is a way to do this in struts?

Any help would be appreciated.

Edited by: Arrowx7 on Sep 7, 2008 9:24 AM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 12 2008
Added on Sep 7 2008
4 comments
2,542 views