0% found this document useful (0 votes)
4 views1 page

Serv Let

The document outlines the life cycle of a servlet, which includes loading the servlet class, creating an instance, initializing it, processing requests through the service method, and finally destroying it when the client closes the web page. It also describes three ways to create a servlet: by implementing the Servlet interface, the GenericServlet class, or the HttpServlet class.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views1 page

Serv Let

The document outlines the life cycle of a servlet, which includes loading the servlet class, creating an instance, initializing it, processing requests through the service method, and finally destroying it when the client closes the web page. It also describes three ways to create a servlet: by implementing the Servlet interface, the GenericServlet class, or the HttpServlet class.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Servlet

Life cycle of servlet:


1)Load servlet class into memory (load once, after
request from web container. It is loaded with help
of class loader in JVM)
2)Create instance of servlet.
3)Initialize servlet using init(). (this method is called
once on first request of web container)
4)Calling of service() method for processing. (this
method is called several times, revices request and
then forwarded to the server from client machine)
5)Calling of destroy().(instance and memory block is
released along with all the resources allocated to
the client, once the client closes the web page.)

Ways to create a servlet


1)myservlet implements servlet
2)myservlet Implements generic servlet
3)myservlet Implements http servlet

You might also like