This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Servlets and the fly likes req.sendRedirect and Servlet.RequestDispatcher diferences Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "req.sendRedirect and Servlet.RequestDispatcher diferences" Watch "req.sendRedirect and Servlet.RequestDispatcher diferences" New topic
Author

req.sendRedirect and Servlet.RequestDispatcher diferences

Partha Athreya
Greenhorn

Joined: Jun 04, 2002
Posts: 4
Hi all..
can anyone plz., let me what exactly is the difference between request.sendRedirect and Servlet.RequestDispatcher methods..
thnx and Regards,
Partha Athreya


Partha Athreya
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

if you want to know the exact difference you'd have to look at the servlet API, but a search of this forum would be a good place to start.
You'd find threads like http://www.coderanch.com/t/348185/Servlets/java/control-transfer
Dave
srinath karkhani
Greenhorn

Joined: Jun 19, 2002
Posts: 14
res.sendRedirect- this is the method which takes the absolute url and when this is executed it adds to the header the url and sends back to the browser client and it wud be treated as a new req then on i.e it makes a extra round of travelling back to the client when its executed.
RequestDispatcher.forward- this method takes the relative url and it just forwards the control to the specified relative url without again goin back to the client browser.
hope this helps if not im sorry
Cheers
Sri
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: req.sendRedirect and Servlet.RequestDispatcher diferences