Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


What is the difference between RequestDispatcher and
sendRedirect?-

Answers were Sorted based on User's Feedback



What is the difference between RequestDispatcher and sendRedirect?-..

Answer / nagababu

RequestDispatcher: server-side redirect with request and
response objects.
sendRedirect : Client-side redirect with new request and
response objects.

Is This Answer Correct ?    21 Yes 0 No

What is the difference between RequestDispatcher and sendRedirect?-..

Answer / sitaram

RequestDispatcher: Serverside redirect with same request
and response objects.
SendRedirect: Client-side redirect with new request and
response objects.

Is This Answer Correct ?    10 Yes 1 No

What is the difference between RequestDispatcher and sendRedirect?-..

Answer / kalyan

RequestDispatcher() method is executed in server-
side,requestdispatcher method is used to transfer the one
page to another serverside page .In this method we can use
the include() and forward() methods .

SendRedirect () method is directly into the client side ....

Is This Answer Correct ?    6 Yes 1 No

What is the difference between RequestDispatcher and sendRedirect?-..

Answer / hitler

The RequestDispatcher is executed in server side, request will
send to one server side program to another server side
programe.advantage of RequestDispatcher is executed fastly in
server side.,
The response.sendRedirct(..) is executed in browser side means
the request url will send to browser url , advantage of
sendRedirect(..) is can intract with one application to
another application.

depand on situvation we are used ..

Is This Answer Correct ?    3 Yes 1 No

What is the difference between RequestDispatcher and sendRedirect?-..

Answer / qim2010

The forward method of RequestDispatcher will forward the
ServletRequest and ServletResponse that it is passed to the
path that was specified in getRequestDispatcher(String
path). The response will not be sent back to the client and
so the client will not know about this change of resource on
the server. This method is useful for communicating between
server resources, (servlet to servlet). Because the request
and response are forwarded to another resource all request
parameters are maintained and available for use. Since the
client does not know about this forward on the server, no
history of it will be stored on the client, so using the
back and forward buttons will not work. This method is
faster than using sendRedirect as no network round trip to
the server and back is required.

An example using forward:
protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException,
IOException {
RequestDispatcher rd =
request.getRequestDispatcher("pathToResource");
rd.forward(request, response);
}

The sendRedirect(String path) method of HttpServletResponse
will tell the client that it should send a request to the
specified path. So the client will build a new request and
submit it to the server, because a new request is being
submitted all previous parameters stored in the request will
be unavailable. The client's history will be updated so the
forward and back buttons will work. This method is useful
for redirecting to pages on other servers and domains.

An example using sendRedirect:
protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException,
IOException {
response.sendRedirect("pathToResource");
}

Is This Answer Correct ?    3 Yes 1 No

Post New Answer

More Servlets Interview Questions

What is servlet container. how it works?

0 Answers  


List out the difference between ServletConfig and ServletContext?

0 Answers  


How we can create war file in servlet?

0 Answers  


How can a servlet refresh automatically if some new data has entered the database?

3 Answers   Citi Bank, CitiGroup, IBM, Satyam,


What is the process for chaining servlet?

0 Answers  


What is the capacity that doGet method can send to the server?

5 Answers  


Explain how does JSP handle run-time exceptions?

0 Answers   BirlaSoft,


How do you invoke a Servlet? What is the difference between doPost method and doGet method?

0 Answers  


Write a hello world program using servlets.

0 Answers  


Explain servlet life cycle?

0 Answers  


What is MIME Type?

0 Answers  


What is meant by servlet? What are the parameters of the service method?

0 Answers  


Categories