What is forward() and include() of servlets
RequestDispatcher interface?

Answers were Sorted based on User's Feedback



What is forward() and include() of servlets RequestDispatcher interface?..

Answer / katamraju

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 ?    41 Yes 9 No

What is forward() and include() of servlets RequestDispatcher interface?..

Answer / srilatha

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 ?    15 Yes 1 No

What is forward() and include() of servlets RequestDispatcher interface?..

Answer / nagababu

include() we have used include method for dispatch the
request, The browser will get the output generated by
Calling Servlet and Called Servlet.

forward() we have used forward method for dispatch request,
The browser will get the output generated by Called Servlet
and Calling Servlet will be discarded.

Is This Answer Correct ?    10 Yes 1 No

What is forward() and include() of servlets RequestDispatcher interface?..

Answer / ravikiran

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 ?    3 Yes 1 No

What is forward() and include() of servlets RequestDispatcher interface?..

Answer / ravikiran

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 ?    3 Yes 4 No

What is forward() and include() of servlets RequestDispatcher interface?..

Answer / suresh

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 ?    5 Yes 19 No

Post New Answer

More Servlets Interview Questions

What is called a session?

0 Answers  


What do you mean by httpservlet and how it is different from the genericservlet?

0 Answers  


how can we create object to a class in a jsp file?

5 Answers   Accenture, L&T, TCS,


What is the use of send redirect () method?

0 Answers  


What is the use of httpservletresponsewrapper?

0 Answers  






I Have A Plan to develop a Project in Struts,I want the template of struts project with Hibernate.Canany body provide me the required information?

0 Answers   IBM,


What do you mean by the servlet chaining?

0 Answers  


What is the directory structure of a war file?

0 Answers  


Difference between jakarta tomcat and apache Tomcat?

4 Answers   IBM,


Explain url encoding in servlet?

0 Answers  


Hi Friends, Suppose you have a web appliction which consists of 100 clients are connected with Connection pooling and they are associated with 100 connection objcet and connected with DB sever,Due some problem DB-Server suddenly crashed and server came to down state for a while after few minutes DB-server once again up,Now how will I manage my Pool Management with my 100 clients...can any one tell me??????????????????

3 Answers   ProgressSoft,


What's the difference between servlets and applets?

0 Answers  


Categories