What’s the difference between sendRedirect and forward methods?


The sendRedirect method creates a new request, while the forward method just forwards a request to a new target. The previous request scope objects are not available after a redirect, because it results in a new request. On the other hand, the previous request scope objects are available after forwarding. FInally, in general, the sendRedirect method is considered to be slower compare to the forward method.

SendRedirect Forward
This method sends a new request always. Th is because it uses the URL bar of the browser for redirecting. This method sends the request to another resource by forwarding it.
This method is used at client side. This method is usead at server side.
This method is used inside and outside the web server. This method is used inside the web server only.
0 answers