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

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between forward () and sendredirect () functions in servlet? Explain

1033


What is cgi?

1025


What must be implemented by all servlets?

1103


Is servlet a framework?

1043


What is the use of request dispatcher interface?

1014


What is lazy loading and what is Generic Servlet Class?

1083


How many servlet objects are created?

1069


How to get the actual path of servlet in server?

1225


What is difference between PrintWriter and ServletOutputStream?

1294


What is the difference between CGI and Servlet?

1080


How we can call a jsp from the servlet?

1011


What is Servlets and explain the advantages of Servlet life cycle?

1109


What is difference between get and post method?

1080


What is Servlet API used for connecting database?

1104


What are the phases of a servlet life cycle?

1120