Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Difference b/w sendRedirect and forward

 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Could anyone let me know the difference b/w the sendRedirect() and forward() methods?
Thanks,
Venu
 
Ranch Hand
Posts: 187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
forward -->Used for forwarding a request from one servlet to another component within the server.
sendredirect--> Sends a temporary redirect response to the client
note the words with in the server ..
hope this helps
 
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear gopal,
response.sendredirect() is not transparent to Browser client. whereas,
RequestDispatcher.forward() is not transparent to Browser client.So in the case of forward(), client browser url will show the older url only but servicing component would be different then that.
Hope i m clear enough,
Best regards
Dharmin Desai
 
Ranch Hand
Posts: 208
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sendredirect is as good as client trying to access a new resource.
Forward happens at the server side hence there is no explicit request from the client for the resource.
Hari
 
SRV Gopal
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Many thanks to Vivek, Dharmin and Hari.
Venu
 
Don't listen to Steve. Just read this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic