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

What is event in java?

640


Which server is best for java?

651


Is a relationship java?

670


What is setbounds in java?

705


What is 'applet container' ?

775


What are j2ee technologies?

644


What do you understand by a thin client?

679


What is jlayeredpane java?

654


What is a thin client?

736


What is j2ee product?

677


What is java 2 platform, micro edition (j2me)?

711


Explain jta, jndi, and jms.

788


Is j2ee a framework?

693


What is the concept of connection pooling?

739


Why class is used in java?

659