difference between forwarding and redirection
Solution 1
forwarding is done without letting client know that, It is used to do internal communication at server, while in redirecting we are asking client go back and ask it over here.
Real life example
Forwarding
You went to postoffice there are number of boxes and person sitting there, now one of them accepts your request and it internally forwards it to other responsible person to fulfil your request and at the end of the process you will get the result
Redirecting
now the same person gives you a token which says goto window no5 and ask that person .
Also See
Solution 2
Read this wikipedia article, which explains it very clearly.
A forward just transfers the responsibility of a single request handling to a new server-dide component (example: servlet --> JSP). A redirect asks the browser to send a new request when a first one has been partially handled (example :create product --> redirect to list of products).
The post-redirect-get pattern, which is explained in the wikipedia article, explains when and why a redirect is preferrable.
Solution 3
fowarding happens on the server side. the server fowards a request to some other page and let that page handle it.
redirection plays between server and client. the server return some HTTP code (dont have in mind now) to the client which tells him the make a new GET request for the page redirected to, this happens without any user interaction.
Solution 4
Forward is transparent to the browser.
Redirect is not. It involves the browser loading a second URL. So I'd assume this is a bit slower.
See here for more info
Related videos on Youtube
dali1985
Updated on June 04, 2022Comments
-
dali1985 almost 2 years
Possible Duplicate:
difference between jsp forward and redirectDoes anyone knows the differences between forwarding and redirection in Http servlets and the impact of these differences on browser refreshes?
-
theyuv over 7 yearsIs it good general practice to perform a redirect upon successful form submit but a forward on an unsuccessful form submit (eg: validation didn't pass)?
-
Patrick Hillert almost 7 yearsExcellent answer with real life example brings it to the point. Thumbs up!