This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

redirect from jsp after download

 
prabhu kiran
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

can anybody tell me how to redirect to another jsp page after download is completed
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can you elaborate your question . often , redirect to another jsp use response.sendRedirect("url")
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 window.open() to fire a new request to the file download and let the normal request be redirected.

E.g.


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.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic