0

What is the difference between request.sendRedirect()

and

requestDispatcher.forward()

in terms of request parameters?

Nitul
  • 917
  • 9
  • 31
  • this one is a Duplicate already answered http://stackoverflow.com/questions/629152/sendredirect-or-request-dispatch-is-more-efficient and http://stackoverflow.com/questions/2047122/requestdispatcher-interface-vs-sendredirect – Narayan Mar 17 '11 at 07:17

1 Answers1

1

Forward

* a forward is performed internally by the servlet
* the browser is completely unaware that it has taken place, so its original URL remains intact
* any browser reload of the resulting page will simple repeat the original request, with the original URL

Redirect

* a redirect is a two step process, where the web application instructs the browser to fetch a second URL, which differs from the original
* a browser reload of the second URL will not repeat the original request, but will rather fetch the second URL
* redirect is marginally slower than a forward, since it requires two browser requests, not one
* objects placed in the original request scope are not available to the second request

see here

Prince John Wesley
  • 58,850
  • 11
  • 80
  • 91