- Servlet life cycle is generally three methods can be used to represent:
- init (): only once, it is responsible for initializing Servlet object when loading Servlet
- service (): Core method, there will be general HttpServlet get, post two approaches. When calling doGet and doPost methods and constructs servletRequest servletResponse request and response objects as parameters.
- destory (): executed when stopping and uninstall Servlet, responsible for the release of resources
- Focus on talk about Servlet initialization:
- Servlet class and loading data corresponding .class
- Creating objects ServletConfig
- Creating the Servlet objects
- HttpServletRequest and HttpServlceResponse object is calling the service () as a parameter passed when the method.
Edited 2019.7.25