What is difference between Forward() and sendRedirect()
methode?

Answer Posted / shakir khan

The RequestDispatcher forward and include methods are
internal to a servlet container and does not affect the
public url of the webresource.

forward() are excute on the server side.

when a forward() is invoked,the request is sent to another
resource on the server without the client being inform that
a different resource is going to process the request.This
occurs completely with in the webcontainer.

sendRedirect() excutes on the client side.

When a sendRedirect()is invoked,it causes the webcontainer
return to the browser,indicating that a new url should be
requested because the browser issues a completely new
request,any object that are stored as request attributes
before the redirect occurs will be lost.
This extra round trip,a redirect is slower than forward.

Is This Answer Correct ?    45 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What do you mean by annotations in servlet?

588


How can I send user authentication information while making URL Connection?

549


how to link html file to sevlet file.one name is textbox,c&c++ is cheakbox,bc&mca is radio button and one submit buttonis ok why in this programme use in servelt file

2088


What is the difference between the include() and forward() methods?

571


what do you understand by url rewriting?

548






What is the effective way to make sure all the servlets are accessible only when user has a valid session?

572


Hi frnd can i any one kindly can post for me portlet,hibernate and spring example application and with flow explantion configuration using Jdeveloper.and related links ar tutorials kindly please send me .its urgent for me .thanks in advance...........else can any one send to kondaiah.goddeti@gmail.com

1746


Which event is fired at the time of session creation and destroy?

879


What is the GenericServlet class?

604


Which event is fired at the time of project deployment and undeployment?

790


how the HTML data stored in web server?

1955


What is java servlet session?

532


Why are http servlets used in programming?

547


Why the concept of single thread model interface is used?

555


How does Cookies work in Servlets?

651