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

Answer Posted / bhupathi.vm

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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is j2ee a language or framework?

473


Why is java robust?

647


What is javafx java?

518


What is a panel java?

545


Is java important for my computer?

474






Why is java considered dynamic?

549


What is component contract?

524


What is a java application server?

483


What is java actionlistener?

472


Who gave the name java?

463


What are the components of j2ee?

449


What is single tier architecture in java?

478


What is event handling in java?

481


What is context attribute?

551


What is use of final keyword in java?

500