📄 initializelibrary.java
字号:
/* * InitializeLibrary.java * * */package com.dvd.web;import com.dvd.model.DVDLibrary;import javax.servlet.ServletContext;import javax.servlet.ServletContextListener;import javax.servlet.ServletContextEvent;/** * * @author * @version * * Web application lifecycle listener. */public class InitializeLibrary implements ServletContextListener { /** * ### Method from ServletContextListener ### * * Called when a Web application is first ready to process requests * (i.e. on Web server startup and when a context is added or reloaded). * * For example, here might be database connections established * and added to the servlet context attributes. */ public void contextInitialized(ServletContextEvent evt) { } /** * ### Method from ServletContextListener ### * * Called when a Web application is about to be shut down * (i.e. on Web server shutdown or when a context is removed or reloaded). * Request handling will be stopped before this method is called. * * For example, the database connections can be closed here. */ public void contextDestroyed(ServletContextEvent evt) { // TODO add your code here e.g.: /* Connection con = (Connection) e.getServletContext().getAttribute("con"); try { con.close(); } catch (SQLException ignored) { } // close connection */ }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -