ITeye博客

jee中的监听器

BBjava · 2012-03-22 13:15 · j2ee · 开源软件 · Markdown

在web.xml是有一项

<listener>
		<listener-class>org.iteye.bbjava.YourFuncListener</listener-class>
	</listener>

其中org.iteye.bbjava.yourFuncListener就是你自已的监听器。 下面是监听器的写法:


public class YourFuncListener implements ServletContextListener {

	private static final long serialVersionUID = -2153378435692476097L;
		public void contextDestroyed(ServletContextEvent arg0) {
			// TODO Auto-generated method stub
			
		}
		public void contextInitialized(ServletContextEvent event) {
                         // TODO Auto-generated method stub
		}
}


ServletContextEvent : This is the event class for notifications about changes to the servlet context of a web application.

什么时候需要监听器?

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。