File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes redirect from jsp after download Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "redirect from jsp after download" Watch "redirect from jsp after download" New topic

redirect from jsp after download

prabhu kiran

Joined: Jan 09, 2009
Posts: 1

can anybody tell me how to redirect to another jsp page after download is completed
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

can you elaborate your question . often , redirect to another jsp use response.sendRedirect("url")
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
prabhu kiran wrote:
can anybody tell me how to redirect to another jsp page after download is completed

That's not possible. You can send only one response per request. You already sent the file as response to the request. You cannot change it anymore nor mingle different responses into one response.

To send another response, the client has to send another request. So to send a download and a redirect, the client needs to send two requests. There are several ways to achieve this with a single click. Easiest way is to use Javascript's to fire a new request to the file download and let the normal request be redirected.


Another way is to execute the download using Javascript during the onload event of another.jsp.
It is sorta covered in the JavaRanch Style Guide.
subject: redirect from jsp after download
Similar Threads
Processing icon with simple jsp approach
Auto Redirect Jsp Page
Need suggestions to count no of hits for Download link
submiting the output in same page
Redirect content to an external Page Flow