Servlet Key Points
来源:互联网 发布:淘宝代刷远程单安全吗 编辑:程序博客网 时间:2024/04/28 21:11
init() method
The lifecycle of a servlet is controlled by the container in which the servlet has been deployed. When a request is mapped to a servlet, the container performs the following steps.
- (1) If an instance of the servlet does not exist, the web container.
- a. Loads the servlet class.
- b. Creates an instance of the servlet class.
- c. Initialises the servlet instance by calling the init method.
- (2) Invokes the service method, passing request and response objects.
destroy() method
The destroy() method is called only once at the end of the life cycle of a servlet. This method gives your servlet a chance to close database connections, halt background threads, write cookie lists or hit counts to disk, and perform other such cleanup activities.
Called by the servlet container (when server is shutdown) to indicate to a servlet that the servlet is being taken out of service. This method is only called once all threads within the servlet’s service method have exited or after a timeout period has passed. After the servlet container calls this method, it will not call the service method again on this servlet.
How to load Servlet on server(tomcat) start-up
In web.xml file add:
<servlet>...<loadon-startup>1</loadon-startup>...</servlet>
Modifying servlet file during server running
Server will recompile servlet java file to .class file and reload. The container (server) will first destroy() all inited servlet and reload(compile). Constructor, init() still will be executed at the first time user issue request if not specified in web.xml.
- Servlet Key Points
- Unit Test Key Points
- training key points
- 逻辑回归key points
- Grasp WPF with key points
- OpenGL Shader Key Points (1)
- OpenGL Shader Key Points (2)
- OpenGL Shader Key Points (3)
- Key Points about ActiveSupport::Concern
- Selenium learning key points summary
- Review some key points of Git
- web.xml配置web中的key points
- Key Points from "Introduce to Data Science"
- face key point with 7 points
- AT&T Features - Key Knowledge Points
- List key points and then extend details if necessary
- 《code complete》第二版 各章节key points汇总
- Key points for biometrical character-based recognition technology
- SSL/TLS原理详解
- spring使用注解标注过滤器(Filter)
- nyoj 1274 && 河南省第九届ACM竞赛C题
- HDOJ 1862 EXCEL排序 (结构体排序的构造)
- [POJ1987]Distance Statistics(点分治)
- Servlet Key Points
- iOS NSMutableDictionary 键值对中出现no summary
- hd 1803 The MAX(sort)
- php curl 请求302跳转页面
- 欢迎使用CSDN-markdown编辑器
- UVA 10480 Sabotage (最大流最小割)
- RSA加密算法详解
- SQL Server 2008 中SQL查询语句中字段值不区分大小写问题处理
- Java中HashMap与Hashtable的区别