aspose file tools*
The moose likes Servlets and the fly likes Regarding Redirect concepts. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Regarding Redirect concepts." Watch "Regarding Redirect concepts." New topic
Author

Regarding Redirect concepts.

Nitya Sundar
Greenhorn

Joined: Nov 13, 2012
Posts: 15
what is the difference between "sendRedirect" and "forward" ?Thanks in advance.
Ankit Dan
Ranch Hand

Joined: Aug 31, 2012
Posts: 47

In Short, forward, transfers control of the request to another resource. redirect instructs the browser to make a new request.

Edit-
Consider the real world scenario, the milk man comes and asks for monthly payment to you in your house. Here house is the container and you are a resource existing in the container. Milk man is the client or browser.

He asks for the monthly payment to you, this is the request made by the browser to resource A. If you go inside your house and ask your mother (another resource B inside the same container) for the cash and come back and deliver to milkman this is called forward.

If you ask the milkman to speak himself to your mother inside your house or you ask the milkman to speak to your father who is in his office (different domain) then this is called redirect.
Nitya Sundar
Greenhorn

Joined: Nov 13, 2012
Posts: 15
Ankit you are basically saying that redirect may happen in same domain or in different domain but in case of forward its restricted within a particular domain or it's different.please reply.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60082
    
  65

This is covered in the ServletsFaq, please check there before posting.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Regarding Redirect concepts.
 
Similar Threads
How to set traverse string using canvas
SCJP 1.5 review - not a so good test?
TOMCAT Environmental Variables
Prevent intermediate access to any jsp page
design the Java swing with dynamic creation of JTextfield,JLabel,Jcombobox