What is the key difference between using a and HttpServletResponse.sendRedirect()?(a) forward executes on the client while sendRedirect() executes on the server. (b) forward executes on the server while sendRedirect() executes on the client. (c) The two methods perform identically.

(b)

Showing Answers 1 - 1 of 1 Answers

ans is B,sendRedirect always sends a header back to the client/browser. this header then contains the resource(page/servlet) which u wanted to be redirected. the browser uses this header to make another fresh request. and it take extra round trip,request scope attributes r not available for next page.where as the forward , is server side,that means server directly root the next page ,and no headers r sent to the browser which makes this very eficient.also the request and response objects remain the same both from where the forward call

  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