JSP
ServletContext 객체
당근개발자
2021. 5. 1. 22:20
ServletContext 객체는 웹 애플리케이션 서비스가 준비되는 시점에 생성, 중지될 때 삭제가 된다.
ServletContextEvent -> ServletContext 객체가 초기화되거나 삭제되는 시점에 발생
ServletContextAttributeEvent -> 객체에 정보를 등록,삭제 갱신하는 시점에 발생
-ServletContext
ServletContextEvent | ServletContext 객체가 생성되거나 해제될때 발생 |
ServletContextAttributeEvent | ServletContext 객체에 정보가 등록,삭제될때 발생 |
-ServletContextListener
public void contentDestroyed(ServletContextEvent e) | ServletContext 객체가 삭제될때 호출 |
public void contentInitalized(ServletContextEvent e) | ServletContext 객체가 생성될때 호출 |
-ServletContextAttributeListener
public void attributeAdded(ServletContextAttributeEvent e) | ServletContext 객체에 정보가 등록될 때 호출 |
public void attributeRemoved(ServletContextAttributeEvent e) | ServletContext 객체에 정보가 삭제될때 호출 |
public void attributeReplaced(ServletContextAttributeEvent e) | ServletContext 객체의 정보가 갱신될때 호출 |
@WebListener ->> 리스너 등록 할수 있음