2 posts in topic
Flat View  Flat View

Posted By:   bhaskar_ramaraju
Posted On:   Sunday, March 30, 2003 06:24 AM

What is the differnce between RequestDispatcher's forward and jsp:forward?


Posted By:   Christopher_Koenigsberg  
Posted On:   Monday, March 31, 2003 06:34 AM

Unless I am mistaken, there IS no difference, because the "jsp:forward" tag actually uses a "RequestDispatcher" for doing the forward, in the servlet that gets generated from the jsp...


Posted By:   Brian_Glodde  
Posted On:   Sunday, March 30, 2003 07:14 PM

Doing an HTTP redirect requires a round-trip to the client. If this is not required, and the only desire is to forward the request to another resource, then this can be much more efficiently accomplished with the RequestDispatcher. Additionally, when using the dispatcher the state of the request object is maintained between resources, which will not be the case with the HTTP redirect.

When using the RequestDispatcher, you will not be able to change the URL in yor browser. This is because your handling page and the forwarded page share the same request. If you want the browser URL to change, sendRedirect is the one to use.

About | Sitemap | Contact