Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

SendRedirect Vs RequestDispatcher

 
Sandeep Vaid
Ranch Hand
Posts: 392
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think there is one more difference between sendRedirect() and requestDispatcher is that sendRedirect() can also redirect to a pure absolute URL (http://www.rediff.com) while requestDispatcher can't...
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think there is one more difference between sendRedirect() and requestDispatcher

One more difference ? What other differences are you referring to ?

is that sendRedirect()

Which sendRedirect are you referring to ?
 
Sandeep Vaid
Ranch Hand
Posts: 392
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am refering to the differences already given in HFSJ book.
 
bernard savary
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sandeep I think there is only 1 sendRedirect which belongs to HttpServletResponse , the RequestDispatcher has only foward and include methods . Anybody Please correct me if I'm wrong
 
Sandeep Vaid
Ranch Hand
Posts: 392
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
bernard you are right...
Here we are discussing the differences between response.sendRedirect() and requestDispatcher.forward() as they more or less do the same job of forwarding to another resource...
 
Narendra Dhande
Ranch Hand
Posts: 951
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

sendRedirect is somewhat client side activity. That is the url in the browser changed when you redirect the response. The browser or client is responsible to sent the new URL. In case of requestDispatcher the URL in browser is not changed, and the container forward your request to different target.

Thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic