• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

req.sendRedirect and Servlet.RequestDispatcher diferences

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 https://coderanch.com/t/348185/Servlets/java/control-transfer
Dave
 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic