ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
tip   SiteMap shows list of All Categories in this site.
Google
 
Categories  >>  Software  >>  Java J2EE  >>  Java Related  >>  Servlets
 
 


 

 
 Core Java interview questions  Core Java Interview Questions
 Advanced Java interview questions  Advanced Java Interview Questions
 Swing interview questions  Swing Interview Questions
 EJB interview questions  EJB Interview Questions
 Servlets interview questions  Servlets Interview Questions
 Struts interview questions  Struts Interview Questions
 JDBC interview questions  JDBC Interview Questions
 JMS interview questions  JMS Interview Questions
 SunOne interview questions  SunOne Interview Questions
 J2EE interview questions  J2EE Interview Questions
 Weblogic interview questions  Weblogic Interview Questions
 Websphere interview questions  Websphere Interview Questions
 Java Networking interview questions  Java Networking Interview Questions
 Java J2EE AllOther interview questions  Java J2EE AllOther Interview Questions
Question
difference between forward and sendredirect
 Question Submitted By :: Vijayk
I also faced this Question!!     Rank Answer Posted By  
 
  Re: difference between forward and sendredirect
Answer
# 1
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 ?    26 Yes 1 No
Neeraj_passion2001
[SOWSIA INDIA PVT LTD]
 
  Re: difference between forward and sendredirect
Answer
# 2
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 ?    16 Yes 3 No
Uv
 
 
 
  Re: difference between forward and sendredirect
Answer
# 3
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 ?    10 Yes 0 No
Dsr
 
  Re: difference between forward and sendredirect
Answer
# 4
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 ?    2 Yes 0 No
Srinu
 
  Re: difference between forward and sendredirect
Answer
# 5
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 ?    1 Yes 1 No
Ravikiran
 

 
 
 
Other Servlets Interview Questions
 
  Question Asked @ Answers
 
HTTP tunneling means what?  1
Explain life cycle of a Servlet?  1
which type of data passing is used in realtime?  1
Is classes folder is compulsory in web-inf/ even though u r deploying ur application with war file? Bosch2
can v create a constructor 4 servlet? Satyam4
how a user session can be tracked in servlets?  1
when will cookie information destroy?  4
Can a servlet be called by passing its name as a parameter in the URL? iFlex1
What is the need of session tracking in HttpServlet ?  3
where the generated jsp source file are stored? HCL5
What are setComment and getComment methods in Cookies?  2
How variables can be accessed across the sessions?  3
What is URL Rewriting ?  1
when you comppile the servlet is it neccesary to restaet the tomcat server? HCL6
Can we use javascript in Servlets? Wipro2
if u havea .class file ,how can u say whether it is servlet or not ,dont use java decompliler Polaris3
What advantages do servlets have over CGI programs?  4
can anybody send me j2ee softwares such as tomcat,weblogic server ,netbeans  2
What is servlet? Siemens13
what is the control flow in servlet when we send a request?  3
 
For more Servlets Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com