This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Servlets and the fly likes sendRedirect method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "sendRedirect method" Watch "sendRedirect method" New topic
Author

sendRedirect method

Derek Nahabedian
Greenhorn

Joined: Jun 21, 2011
Posts: 3

I understand when a sendRedirect is executed, a 301 or 302 response is sent to the client, along with the desired URL. The browser then issues a new request for the desired URL.

My question is what HTTP method is generated under the hood? Get or Post?
Can a Get / Post be specified?

Thank you
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

The browser will generate a new Get request in response to your 300-sequence response. You don't have any choice about that.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60766
    
  65

And thank goodness. It's what enables the P-R-G pattern!


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Derek Nahabedian
Greenhorn

Joined: Jun 21, 2011
Posts: 3

Thank you both - I am reading up on the PRG pattern.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: sendRedirect method
 
Similar Threads
error in servlet due to reasons unknown
forward and sendRedirect methods
forwarded to jsp displays content in previous jsp
URLConnection question, Posting
Which kind(POST/GET) of request is used for JSp