?? servletcontextdemo.java
字號:
package cn.mldn.lxh.listener ;
import javax.servlet.* ;
public class ServletContextDemo
implements ServletContextListener,ServletContextAttributeListener
{
private ServletContext application = null ;
// 實現方法
public void contextInitialized(ServletContextEvent sce)
{
this.application = sce.getServletContext() ;
System.out.println("** 上下文初始化 ...") ;
System.out.println("** 當前虛擬目錄的絕對路徑:"+this.application.getRealPath("/")) ;
}
public void contextDestroyed(ServletContextEvent sce)
{
System.out.println("** 上下文銷毀 ...") ;
}
public void attributeAdded(ServletContextAttributeEvent scab)
{
System.out.println("** 增加屬性:"+scab.getName()+" --> "+scab.getValue()) ;
}
public void attributeRemoved(ServletContextAttributeEvent scab)
{
System.out.println("** 刪除屬性:"+scab.getName()+" --> "+scab.getValue()) ;
}
public void attributeReplaced(ServletContextAttributeEvent scab)
{
System.out.println("** 替換屬性:"+scab.getName()+" --> "+scab.getValue()) ;
}
};
/*
<listener>
<listener-class>cn.mldn.lxh.listener.ServletContextDemo</listener-class>
</listener>
*/
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -