(동영상)서블릿 컨텍스트 리스너(ServeltContextListener)란? ServletContext 개념, 서블릿 컨텍스트 리스너 작성 실습
http://ojc.asia/bbs/board.php?bo_table=LecServletJSP&wr_id=285
package listener;
……
//@WebListener
public class MyListener implements ServletContextListener {
private ServletContext ctx = null;
public void contextDestroyed(ServletContextEvent sce) { System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Web App Destroyed...");
ctx = null;
}
public void contextInitialized(ServletContextEvent sce) {
ctx = sce.getServletContext(); System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Web App Init...");
System.out.println(ctx.getServletContextName());
}
}
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">
<listener>
<listener-class>listener.MyListener</listener-class>
</listener>
</web-app>
#서블릿컨텍스트, #ServletContext란, #서블릿강좌, #서블릿동영상, #자바서블릿, #서블릿컨텍스트리스너, #ServletContextListener, #서블릿컨텍스트란, #ServletConfig, #자바서블릿동영상, #서블릿동영상,
댓글 없음:
댓글 쓰기