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...


difference between forward and sendredirect

Answers were Sorted based on User's Feedback



difference between forward and sendredirect..

Answer / neeraj_passion2001

FORWARD-->
1. THE REQUEST AND RESPONSE OBJECT REMAIN SAME.
2. CONTROL DIRECTLY GOES TO REQUESTED PAGE AT THE POINT
WHERE FORWARD IS CALLED.
3. REQUEST DISPATCHER IS NEEDED.

SEND REDIRECT:--->
1.NEW REQUEST AND RESPONSE IS GENERATED IN CASE THIS CASE.
2.IN THIS CASE FIRST CONTROL GOES TO CLIENT(BROWSER) AND
THEN TO REQUESTED PAGE.
3.JUST RESPONSE OBJECT IS NEEDED.

Is This Answer Correct ?    33 Yes 2 No

difference between forward and sendredirect..

Answer / uv

If I am not wrong,
forward() is used to transfer the request within the web
application whereas sendRedirect() is used to transfer the
request from one webapplication to another.

Is This Answer Correct ?    21 Yes 5 No

difference between forward and sendredirect..

Answer / dsr

FORWARD-->
1. THE REQUEST AND RESPONSE OBJECT REMAIN SAME.
2. CONTROL DIRECTLY GOES TO REQUESTED PAGE AT THE POINT
WHERE FORWARD IS CALLED.
3. REQUEST DISPATCHER IS NEEDED.
4.forward() is used to transfer the request within the web
application

SEND REDIRECT:--->
1.NEW REQUEST AND RESPONSE IS GENERATED IN CASE THIS CASE.
2.IN THIS CASE FIRST CONTROL GOES TO CLIENT(BROWSER) AND
THEN TO REQUESTED PAGE.
3.JUST RESPONSE OBJECT IS NEEDED.
4.sendRedirect() is used to transfer the request from same
webapplication or different webapplication.

Is This Answer Correct ?    13 Yes 5 No

difference between forward and sendredirect..

Answer / srinu

FORWARD----->
1) in Forward request and response object be same.
2)IN FORWARD METHOD THE CONTROLLER DIRECTLY GOES TO OTHER
PAGE WHEN U CALL THE FORWARD METHOD.
3)FORWARD METHOD USED WITH IN WEBAPPLICATION .
4)In this case controller goes directly go to request
page.i.e means does not generated implict reponse go to
browser.
5)U CALL THE FORWARD METHOD JUST NEDDED OBJECT OF
REQUESTDISPACTHER OBJECT

EX:-
RequestDispacher rd=null;
rd = req.getRequestDispatcher("/WA1");
rd.forward(req,res);
5)it used small webapplication.

sendredirect:-
1)in sendRedirect()request,reponse object will not be same.
2)in sendRedirect()method the controller did not pass directly.
3)it over come the drawback of forward()(just watch 3 step
in forward()) this method used with in webapplication or
outside of webapplication.
4)In this case first controller goes client browser window
after it will go to request page.i.e means implict reponse
go to browser.
5)u call the sendRedirect() method u need a response object.

EX:-
response.sendRedirect("/ServletProject/ValidUser");

Is This Answer Correct ?    8 Yes 3 No

difference between forward and sendredirect..

Answer / ravikiran

forward will happen in the server side,and send redirect
will happen in the client's browser...,and with forward we
can forward with in the same web application,and with send
redirect we can transfer the flow to a different web application

Is This Answer Correct ?    5 Yes 3 No

difference between forward and sendredirect..

Answer / nagababu

Forward: server-side redirect with request and response
objects with in same web Container.
sendRedirect : Client-side redirect with new request and
response objects with diffrent web containers also.

Is This Answer Correct ?    2 Yes 0 No

Post New Answer

More Servlets Interview Questions

How to debug a servlet?

2 Answers  


What is the difference between ExecuteUpdate and ExecuteQuery?

4 Answers  


What is DSN and System DSN and what is the difference between them?

2 Answers  


can i modify the data which are generated by the servlet

4 Answers  


What are the life cycle methods of a servlet?

0 Answers  


What do you mean by annotations in servlet?

0 Answers  


What are the advantages of servlets over traditional cgi?

0 Answers  


When is the servlet instance created in the life cycle of servlet? What is the importance of configuring a servlet?

0 Answers  


Is Servlet Class Thread safe?????? How to make servlet Thread safe ???

4 Answers   Cognizant,


Is the init(ServletConfig sc) throws IOException or not?

3 Answers  


What is the process for chaining servlet?

0 Answers  


how JSP can extend servlet or interface ...?

3 Answers   IBM,


Categories