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

Which one is better forward() or sendRedirect() ????

 
Naina Si
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are there any advantages of using forward() over sendredirect() apart from the fact that with forward() request are not sent to the client where as with sendredirect() client initiates a new request.
 
Nicholas Cheung
Ranch Hand
Posts: 4982
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Forwarding ususally has a fast performance within the same application, because the forward is done internally.

If you use redirect, your request will be processed twice, since the server tells you to fire another request on your own.

Nick
 
Nicholas Cheung
Ranch Hand
Posts: 4982
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh, I forget to mention that, the number of requests to be handled simutaneously, the network bandwidth, the round trip time etc will also be your consideration.

As the network cost of redirecting a request to the application within the same server costs double that than using forward.

Nick
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic