• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

RequestDispatcher

 
rajanidhi rajasekeran
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hai all,
What is the difference b/w RequestDispatcher.Forward() and Response.redirect().I am totally confused with this, plz help.
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think redirect requires another round trip between the client and server, and forward does not.
that is one difference, there are moer, but I can't remember them offhand.
Good Luck
mar
 
Krishna Srinivasan
Ranch Hand
Posts: 1862
Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
forwared() will process in server side.client don't know what's happening inside.
but senredirect will return the request to client and redirect to new request.so,it is totally new request.
 
Roger Chung-Wee
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When forwarding to an HTML page containing relative URLs included, RequestDispatcher's forward() does not notify the client about the directory from which the page is served, hence the links may be broken. Instead, use HttpServletResponse's sendRedirect() as the servlet container must convert the relative URL to an absolute URL before sending the response to the client.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic