✔ SERVLET CHAPTERS:-
1. Servlet Arctitecture Overview
2. Life cycle of Servlet
3. Servlet Interface
4. Generic Servlet Class
5. Http Servlet Class
6. Deployment Descriptor Webxml
7. Welcome File List In Webxml
8. Load On Startup in Webxml
9. Request Dispatcher Interface
10. Sendre Direct In Servlet
11. Servlet init Parameters
12. Servlet context Parameters
13. Servlet Hello World Example
14. Session Management Cookies
15. Cookie in Servlet
16. Hidden Field In Servlet
17. URL rewriting In Servlet
18. Http session In Servlet
19. Servlet Filter In Java
20. Filter Config Interface
1. Servlet Arctitecture Overview
2. Life cycle of Servlet
3. Servlet Interface
4. Generic Servlet Class
5. Http Servlet Class
6. Deployment Descriptor Webxml
7. Welcome File List In Webxml
8. Load On Startup in Webxml
9. Request Dispatcher Interface
10. Sendre Direct In Servlet
11. Servlet init Parameters
12. Servlet context Parameters
13. Servlet Hello World Example
14. Session Management Cookies
15. Cookie in Servlet
16. Hidden Field In Servlet
17. URL rewriting In Servlet
18. Http session In Servlet
19. Servlet Filter In Java
20. Filter Config Interface
Servlet Architecture overview: Previous Next: Servlet Interface in Java
Life cycle of a servlet
Life cycle of a servlet is managed by web container.
Servlet life cycle steps:
- 1. Load Servlet Class.
- 2. Create Servlet instance.
- 3. Call init() method.
- 4. Call service() method.
- 5. Call destoy() method.
1. Load Servlet Class: Web container loads the servlet when the first request is received. This step is executed only once at the time of first request.
2. Create Servlet instance: After loading the servlet class web container creates the servlet instance. Only one instance is created for a servlet and all concurrent requests are executed on the same servlet instance.
3. Call init() method: After creating the servlet instance web container calls the servlet’s init method. This method is used to initialize the servlet before processing first request. It is called only once by the web container.
4. Call service() method: After initialization process web container calls service method. Service method is called for every request. For every request servlet creates a separate thread.
5.Call destoy() method: This method is called by web container before removing the servlet instance. Destroy method asks servlet to releases all the resources associated with it. It is called only once by the web container when all threads of the servlet have exited or in a timeout case.