import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class LoadParam implements ServletContextListener{
Logger logger = LoggerFactory.getLogger(LoadParam.class);
/**
* @see javax.servlet.ServletContextListener#contextDestroyed(javax.servlet.ServletContextEvent)
*/
@Override
public void contextDestroyed(final ServletContextEvent arg0) {
}
/**
* @see javax.servlet.ServletContextListener#contextInitialized(javax.servlet.ServletContextEvent)
*/
@Override
public void contextInitialized(final ServletContextEvent arg0) {
arg0.getServletContext().setAttribute("contextPath", arg0.getServletContext().getContextPath());
//增加调用你要做的事情
}
}
在web.xml中增加Listener定义,其中package你自己定义
这种还有必要用quartz吗?