package com.blogspot.na5cent.web;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;
/**
* Web application lifecycle listener.
*
* @author redcrew
*/
@WebListener
public class Na5centServletListener implements ServletContextListener {
@Override
public void contextInitialized(ServletContextEvent sce) {
//ทำงานก่อน application start
}
@Override
public void contextDestroyed(ServletContextEvent sce) {
//ทำงานหลังจาก stop application
}
}
วันเสาร์ที่ 21 กรกฎาคม พ.ศ. 2555
ServletContextListener
ประโยชน์คือ เอาไว้กำหนดค่าเริ่มต้นบางอย่างให้กับ application ของเรา มันจะทำงานก่อนที่ application จะถูก start ขึ้น คือทำงานก่อน application เสมอ
สมัครสมาชิก:
ส่งความคิดเห็น (Atom)
ไม่มีความคิดเห็น:
แสดงความคิดเห็น