*
The moose likes Servlets and the fly likes Redirect, but POST wanted. 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 » Servlets
Bookmark "Redirect, but POST wanted." Watch "Redirect, but POST wanted." New topic
Author

Redirect, but POST wanted.

Vishal Saxena
Greenhorn

Joined: Apr 23, 2003
Posts: 26
hi,
If I redirect to a URL, I achieve a GET. How to achieve a POST ?


Thx -V
Amol Desai
Ranch Hand

Joined: Jan 29, 2003
Posts: 82
Hi,
This link below could be useful to you.
http://www.coderanch.com/t/347293/Servlets/java/Do-Forward-Redirect-Extra-Parameters
-Amol
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

It's a thought, but I'm not sure it will work.
One thing to try is to redirect to an intermediate page, and have the intermediate page do an 'auto-post' to the page you want.
The intermediate page would look like this:

Dave
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
I have seen this submit done in a Javascript "page complete" event. Anybody recall that actual event name? Is it necessary to put it there, or is it ok as shown in the post above? Let us know how this works out for you!


A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60791
    
  65

I have used the technique that David outlined above many times with great success.
hth,
bear


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Dana Hanna
Ranch Hand

Joined: Feb 28, 2003
Posts: 227
The only bad side to David's approach is that the back button won't let the user back through (unless they click it REAL fast).
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Redirect, but POST wanted.
 
Similar Threads
calling doPost from response.sendRedirect
Refresh problem
sendRedirect versus ServletOutputStream
Redirect using JSF tag
Hide parameter while redirecting to external resource