• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Difference b/w sendRedirect and forward

 
SRV Gopal
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
 
vivek sivakumar
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
 
Dharmin Desai
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
 
Hari babu
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic