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

Who gave the name java?

473


I’m new to WebLogic Does anyone knows how to Deploy Application using

1759


Why class is used in java?

490


What is java netbeans?

497


What are the advantages in the use of spring for application development?

530






Explain connector architecture.

547


What is j2ee technology?

558


What are the types of j2ee clients?

512


What are the four components of j2ee application?

568


How does j2ee application work?

482


What are j2ee components?

463


What is digest authentication?

556


How do I run java?

484


Is j2ee a programming language?

536


What is use of final keyword in java?

511