This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Servlets and the fly likes Redirect to JSP after file download ?! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Redirect to JSP after file download ?!" Watch "Redirect to JSP after file download ?!" New topic
Author

Redirect to JSP after file download ?!

moh sak
Ranch Hand

Joined: May 11, 2005
Posts: 78
Hi all,

what i want to accomplish is the following :

1- Download a file using (response.SendRedirect(URL) ). there is nothing wrong in here.

2- Redirect the user to another JSP page to display a thanks message for downloading the file. "Who to Do ??!"

as known i can't use the sendRedirect again because the request is commited.

is there any way to reditrect to the JSP ??
or i should redirect the user to the JSP and in it call the download file servlet ?? "which i don't prefer"


thanx in advance.
moh Sakkijha
Jon Emerson
Greenhorn

Joined: Feb 19, 2006
Posts: 5
What most web sites do is redirect to the "thank you" page FIRST, and have the thank you page redirect the user to the requested file to download via a meta refresh.

A simple implementation of this is:



Jon Emerson<br /> <a href="http://www.jonemerson.net" target="_blank" rel="nofollow">http://www.jonemerson.net</A>
moh sak
Ranch Hand

Joined: May 11, 2005
Posts: 78
Hi,

thanks for your reply, i did this because i figure out that its the only way to redirect.

Thanks again
 
Don't get me started about those stupid light bulbs.
 
subject: Redirect to JSP after file download ?!