What is the Difference between sendRedirect() and Forward?

Pata Nahin

Showing Answers 1 - 9 of 9 Answers

Vj

  • Sep 15th, 2005
 

Forward Request- When we invoke a forward request it is sent to another resource on the server itself, without the client being informed that a different resource is going to process the request.The process occurs completly within the web container.

Send-Redirect- When this method is invoked , it causes the web container to return to the browser  indicating that a new URL is requested.Process does not occur just within web container.

Because the browser issues completly new request any object value that are stored as request attributes are lost in case of Send Redirect but forward retains that.

N because of the extra round trip redirect is slower than the forward.  

  Was this answer useful?  Yes

RajashekarReddy

  • Sep 16th, 2005
 

1)sendRedirect()method sends next page url to the client browser.Drawback is Round trip time.2)RequestDispatcher will be done at the server side

  Was this answer useful?  Yes

Anup

  • Oct 31st, 2005
 

sendRedirect is done on client hence visible to them but forward is invisible to the client and is made at server

  Was this answer useful?  Yes

Mannu Kumar Pandey

  • Nov 3rd, 2005
 

redirect send user to a different context while in forward its in same context.

  Was this answer useful?  Yes

Gautam Trivedi

  • Nov 5th, 2005
 

when you use sendRedirect it will first of all go to the client and then it will redirect controll to the requested page. so the url of the browser will be changed.

while when you use forward it will not go the client and directly forward to the requested page.

so the forward is faster than sendRedirect.

  Was this answer useful?  Yes

Jitendra Jain

  • Nov 24th, 2005
 

SendRedirect() will execute on clinet while Forward() will execute on Server.Moreover SendRedirect() is a two phase process while forward() is a one phase process.

  Was this answer useful?  Yes

j_jain_mca

  • Nov 25th, 2005
 

sendRedirect() executes on client while Forward() executes on server. moreover redirect is a 2 phase method and forward is a 1 step process.

  Was this answer useful?  Yes

So many difference for forward and send redirect i will explain as follows

1. in forward the resource will be with in the container,in case of send redirect the resource would be outside the web container.i.e send redirect used for resource contain in the other web application.

2. incase of send redirect there request will back to the browser then redirect to other url i.e extra round trip taken place but it is not possible in forward only one request send to the container.

3. form attributes are not available in the send redirect and it is available in forward i.e request parameter values.

4.According to performance forward will better performance compare to send redirect because it's taking extra round trip

5.Send Redirect is in client and Forward was in server side

i think everybody has clear these facts

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions