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                      
info       Did you received any Funny E-Mails from your Friends and like to share with rest of our friends? Yeah!! you can post that stuff   HERE
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
What is forward() and include() of servlets 
RequestDispatcher interface?
 Question Submitted By :: Gangadhar_interview
I also faced this Question!!     Rank Answer Posted By  
 
  Re: What is forward() and include() of servlets RequestDispatcher interface?
Answer
# 1
Forward():By using forward() method of RequestDispatcher ,ew
can forward a request to a another resource(i.e
servlets,jsp,html....),at finally we can see only called
resource output(i.e second resource output )
For exm. we have two servlets,(servlet1 and servlet2) we are
forwarding request from servlet1 to servlet2, in this case
we can see only servlet2 output.
include():By using include() method of RequestDispatcher we
can forward a request from servlet12 to servlet2 ,in this
case we can see  both outputs(i.e servlet1 and servlet2).

in both case single request and single response.
 
Is This Answer Correct ?    9 Yes 3 No
Katamraju
 
  Re: What is forward() and include() of servlets RequestDispatcher interface?
Answer
# 2
forward() is used to just forward the request and response
object...

include() is used to pass the values and request and
response object,one servlet to another servlet
 
Is This Answer Correct ?    0 Yes 5 No
Suresh
 
 
 
  Re: What is forward() and include() of servlets RequestDispatcher interface?
Answer
# 3
Forward():

In ServletRequestDispatcher ,By using forward() method,we 
can forward a request to a another resource(i.e
servlets,jsp,html....),at finally we can see only called
resource output(i.e second resource output,i.e response)
For exm. we have two servlets,(servlet1 and servlet2) we are
forwarding request from servlet1 to servlet2, in this case
we can see only servlet2 output(i.e response for the 
request).
in forward()it will take only servlet1 output.
(ex: in servlet we a\are having some name like srinu with 
background color blue, it will take only the name not the 
color)

include():

By using include() method of RequestDispatcher we
can forward a request from servlet1 to servlet2 ,in this
case we can see  both outputs(i.e servlet1 and servlet2).

in include()it will include the servlet1 page and 
forwarding to the servlet2)
in this  case we can see both servlet1& servlet2 as the 
part of response.
 
Is This Answer Correct ?    1 Yes 0 No
Srilatha
 
  Re: What is forward() and include() of servlets RequestDispatcher interface?
Answer
# 4
forward will make the flow into a different page,where as
include mechanism will include the page to the current
response and continues the flow.
Note:the forward and include should be called before the
response is committed for example before the call to flush()
or flushBuffer() or the write method in the response stream
 
Is This Answer Correct ?    0 Yes 0 No
Ravikiran
 
  Re: What is forward() and include() of servlets RequestDispatcher interface?
Answer
# 5
forward will make the flow into a different page,where as
include mechanism will include the page to the current
response and continues the flow.
Note:the forward and include should be called before the
response is committed for example before the call to flush()
or flushBuffer() or the write method in the response stream
 
Is This Answer Correct ?    0 Yes 1 No
Ravikiran
 

 
 
 
Other Servlets Interview Questions
 
  Question Asked @ Answers
 
What are the methods in HttpServlet?  5
what are binding listners?  1
What are cookies and how will you use them?  2
Explain Servlet Chaining ?  1
What is the use of RequestDispatcher in servlet?  8
How multiple simultaneous requests can be handled by servlets?  2
Which method the Servlet container call to create the instance of the servlet? emc212
What is the difference between an applet and a servlet? Miracle-Solutions10
what is SSL?  2
How session tracking can be achieved, if your browser doesn't support cookies (or) if cookies are disabled?  2
What is done after deploying a war file and before client gives a request Bosch2
If you want to modify the servlet,will the Webserver need to be ShutDown ?  8
What is the capacity that doGet method can send to the server?  3
How to deal with multi-valued parameters in a servlet?  2
Can a servlet be called by passing its name as a parameter in the URL? iFlex1
How we can check in particular page the session will be alive or not Symbiosis4
what are the CGI Programs?  4
How are Sessions are more advantage than using of Cookies or URLReWriting?  2
what is meant by servlet to servlet communication? KPIT1
How to set a cookie that is persisted only for the duration fo the clients session?  1
 
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