forward
The control can be redirected to resources available on the server from which the call is made. This transfer of control is carried out by the container inside, and the browser / client is not involved. This is the main difference between forward and sendRedirect. When the forward is completed, the original request and response objects are passed along with additional parameters, if necessary.
redirect
Management can be redirected to resources on different servers or domains. This transfer of the management task is delegated to the browser by the container. That is, the redirect sends the header back to the browser / client. This header contains the URL of the resource that will be redirected by the browser. The browser then initiates a new request to the specified URL. Since this is a new request, the old request and response object is lost.
For example, sendRedirect may transfer control from http://google.com to http://anydomain.com , but forwarding is not possible.
'not lost in both direct and forwarding.
To feel the difference between forward and sendRedirect, visually see the address bar of your browser, forward, you will not see the redirected address (since the browser is not involved) when redirecting you can see the redirected address.
Anish Rai Apr 09 '14 at 7:32 2014-04-09 07:32
source share