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

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

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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the different methods of session management in servlets?

941


What methods do you use in servlet - applet communication?

980


What is httpservlet class?

1053


What is the requirement of servlet config and servlet context implemented and how are they implemented?

941


Why the container loads server at the application startup and how?

1007


How do you configure a centralized error handler in servlets?

1027


Explain the difference between jsp and servlet?

1004


What is httpservlet and how it is different from genericservlet?

1037


How do you communicate in between Applets and Servlets?

1020


What are the two important api's in for servlets?

1013


How can you run a servlet program?

1029


Why do we have servlet filters?

976


How to read request headers from servlets?

993


What if we pass negative value in load-on-startup?

1227


What is meant by Servlet? What are the parameters of service method?

1006