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 servlet life cycle?

Answer Posted / rama

The three important functions that implement the life cycle
of servlet are init(),service(),destroy().
When a client/user specifies a request by entering the
URL in the browser the browser generates an HTTP request
for it and sends to the server.
On receiving the HTTP request the server maps a servlet
to this request. the servlet is then dynamically retrieved
and loaded in the memory.
The server now calls the init() method of the servlet.
Parameters can be sent to configure the servlet. This
method is called only once when the servlet is first
loaded.
When a request arrives for this servlet the server
invokes the service() method. this is the method which
handles all the HTTP requests and formulates HTTP response.
For every request service() method is called.
When the server decides to unload the servlet it calls
the destroy() method. Any resources which were used by the
servlet or any open files or any database connections can
be restored so that the memory used by these objects and
the servlet can then be garbage collected.

Is This Answer Correct ?    15 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a java servlet?

1094


What is servlet lazy loading?

1174


What is difference between cookies and httpsession?

1098


What are the disadvantages of storing session state in cookies?

1150


How do you communicate in between Applets and Servlets?

1068


How does Cookies work in Servlets?

1176


What are the steps that are required to handle the multi-threading?

1106


What are the life-cycle methods for a servlet?

1000


What is the servletconfig object?

1045


What are the different mode that servlets can be used?

1021


What are the objects involved when a servlet receives a call from client?

1036


What are the steps involved in placing a servlet within a package?

1078


How do servlets work?

1041


How can we implement a jsp page?

1138


Why is Servlet so popular?

1074