国产精品天干天干,亚洲毛片在线,日韩gay小鲜肉啪啪18禁,女同Gay自慰喷水

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

監(jiān)聽器的代碼

2020-05-18 11:41 作者:小垃圾kiki  | 我要投稿
package cn.itcast.web.listener;

import java.io.FileInputStream;

import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;
@WebListener
public class ContextLoaderListener implements ServletContextListener {
?? ?/*
?? ? * 監(jiān)聽ServletContext對象創(chuàng)建的?? ServletContext對象在服務器啟動后自動創(chuàng)建
?? ? * 在服務器啟動后自動調(diào)用
?? ? */
?? ?@Override
?? ?public void contextInitialized(ServletContextEvent sce) {
?? ??? ?//加載資源文件
?? ??? ?//1.獲取ServletContext對象
?? ??? ?ServletContext servletContext=sce.getServletContext();
?? ??? ?//2.加載資源文件
??????? String contextConfigLocation = servletContext.getInitParameter("contextConfigLocation");

??????? //3.獲取真實路徑
??????? String realPath = servletContext.getRealPath(contextConfigLocation);

??????? //4.加載進內(nèi)存
??????? try{
??????????? FileInputStream fis = new FileInputStream(realPath);
??????????? System.out.println(fis);
??????? }catch (Exception e){
??????????? e.printStackTrace();
??????? }
??????? System.out.println("ServletContext對象被創(chuàng)建了。。。");
?? ?}
?? ?
?? ?/*
?? ? * 在服務器關閉后,ServletContext對象被銷毀。當服務器正常關閉后該方法被調(diào)用
?? ? */
?? ?@Override
?? ?public void contextDestroyed(ServletContextEvent sce) {
?? ??? ?System.out.println(" ServletContext對象被銷毀了");
?? ?}
}

監(jiān)聽器的代碼的評論 (共 條)

分享到微博請遵守國家法律
胶南市| 蒙自县| 岱山县| 龙口市| 扎鲁特旗| 清丰县| 松溪县| 乡宁县| 额尔古纳市| 五常市| 沙洋县| 江西省| 永昌县| 酉阳| 江门市| 汉寿县| 上栗县| 星座| 西林县| 永春县| 洛阳市| 博罗县| 西林县| 巴彦淖尔市| 道孚县| 宝丰县| 绥芬河市| 沭阳县| 通辽市| 丹江口市| 尚义县| 湖南省| 二手房| 闽侯县| 井研县| 连山| 淮安市| 乐至县| 宜丰县| 阿坝县| 辉县市|