Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

req.sendRedirect and Servlet.RequestDispatcher diferences

 
Partha Athreya
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all..
can anyone plz., let me what exactly is the difference between request.sendRedirect and Servlet.RequestDispatcher methods..
thnx and Regards,
Partha Athreya
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic