Servlet Notes
Servlet Notes
http://www.google.com/search?sourceid=navclient&ie=UT
F-8& q=servlet +jsp
There are three methods related to the life cycle of a servlet i.e., init( ),
service( ) and destroy( ).
These methods are called at different times by the servlet.
When a user enters a URL to a web browser, the browser generates
an HTTP request for the URL and sends it to the appropriate server.
This HTTP request is received by the web server.
The web server maps this request with a particular servlet. The servlet
is dynamically retrieved and loaded into the address space of the web
server.
Then server invokes init( ) method of the servlet. This method is
invoked when the servlet is first loaded into memory. Here the
initialization parameters are passed to the servlet.
The server then invokes the service method of the servlet to process
the HTTP request. Servlet will read the data provided to it in the form
of HTTP request and also formulate it. The servlet remains in the
server’s address space and is available for any HTTP request.
When the servlet is unloaded from the server, then destroy( ) method is
called by the server to relinquish resources