bhupathi


{ City } chennai
< Country > india
* Profession * software engineer
User No # 10531
Total Questions Posted # 0
Total Answers Posted # 1

Total Answers Posted for My Questions # 0
Total Views for My Questions # 0

Users Marked my Answers as Correct # 11
Users Marked my Answers as Wrong # 9
Questions / { bhupathi }
Questions Answers Category Views Company eMail




Answers / { bhupathi }

Question { Honeywell, 40283 }

What is the difference between sendRedirect() and forward()?
in what situations do we have to use send redirect()
instead of forward().


Answer

1.forward will forward the request without saving the client
information where as sendRedirect will save the previous
information and send to another requested page.


2.The forward operation happens in the same request itself.
Once if you forward a request, you cannot add any more
response content after the forward command. Becuase, the
servlet ignores the remaining things and forwards the
request to another servlet.

The send redirect is the one, which redirects you to some
other servlet or page. The redirection is not within the
same request, but it is a new request. Using send redirect,
you can access a page available on another context / server.

Is This Answer Correct ?    11 Yes 9 No