5. Life of a servlet
Birth: Create and Intialize the Servlet
Important method: Init()
Life: Handle 0 Or more Client Request
Important method: Service()
Death: Destroy the Servlet
Important method: Destroy ()
7. The init() MethoD
The Init () Method Is Called When The Servlet Is First Request
By A Browser Request
It Is Not Called Again For Each Request
Used For One Time Initialization
9. Life of a servlet
The First Time A Servlet Is Called The Servlet
Is Instantiated And It’s Init() Method is called
Only One Instance Of The Servlet Is Instantiated
This One Instance Handles All Browser Requests
10. Service Method
Each Time The Servlet Receives A Request For A Servlet The Server
Spawns A New Thread And Calls The Servlet Service () Method
12. Death of a servlet
Before A Server Shuts Down It Will Call The Servlet’s Destroy () Method
You Can Handle Any Servlet Clean Up Here.
Ex:
Updating log Files
Closing Database Connections
Closing Any Socket Connections
14. Void int(Servlet Config Config)
-Initializers The Servlet
Void Service (Servlet Request req, Servlet Response res)
-Carries Out A Single Request From the Client
Void Destroy ()
-Cleans Up What Ever Resources Being Held
(Ex: Memory,File Handles)
15. Servlet Config Get Servlet Config()
-Returns As Servlet Config Object Which Contains Any Initialization
Parameters And Start up Configuration For This Servlet
String Get Servlet info()
-Returns A String Containing Information About the Servlet Such as it’s
Authors, Version & Copyright.