|
|
| Servlet |
Expert:prem
Diffrence between forward and sendRedirect method in servlet? |
| Answers |
Hi Friend,
Difference between Redirect and Forward:
* In forward, the request is sent to another resource on the server, without the client being informed that a different resource is going to process the request while sendRedirect causes the web container to return to the browser indicating that a new URL should be requested.
* Forward is much faster in performance compared to sendRedirect.
* In forward the URI does not change while in sendRedirect, the URI is changed.
* Forward will not work in a different servlet context while Redirect works in both same/ as well as different contexts.
* Forward retains the request, but with redirect all request parameters are lost.
* The sendRedirect requires complete URI to process the request while only relative path is sufficient with Forward.
Thanks
|
| More Questions |
|
|
Post Answers
Ask Question
Facing Programming Problem?
|
|
|
|
|