Switch to full style
What's behind JSP & Servlets
Post a reply

Difference between forward and sendRedirect

Fri Nov 07, 2008 12:50 pm

What is the Difference between forward and sendRedirect?

When you invoke a forward request, the request is sent to another resource on the server, without the client being informed that a different resource is going to process the request. This process occurs completely with in the web container. When a sendRedirtect method is invoked, it causes the web container to return to the browser indicating that a new URL should be requested. Because the browser issues a completely new request any object that are stored as request attributes before the redirect occurs will be lost. This extra round trip a redirect is slower than forward.



Re: Difference between forward and sendRedirect

Sat Jul 25, 2009 1:44 pm

forward runs on the server side while sendRedirect runs on the client as well as on the server side thats why the response generated by sendRedirect() is slow as compared to rd.forward().By using sendRedirect() you can forward the request to any web application either in the same server or to the another one.Incase of forward() the request has to be forwarded to the same web application.One more difference is that forward() method holds the previous request and response objects while using sendRedirect(),it will create fresh request and response objects

Post a reply
  Related Posts  to : Difference between forward and sendRedirect
 USB programming back and forward button     -  
 difference between the >> and >>> operators     -  
 Difference between Externalization and Serialzation     -  
 difference between the Boolean & operator and the &&     -  
 Difference between throw and throws     -  
 Difference between PHP echo() and PHP print()?     -  
 difference between upcasting and downcasting     -  
 difference between the String and StringBuffer     -  
 find the difference between dates in asp.net     -  
 difference between a Window and a Frame     -