package com.czetsuya;
import java.text.MessageFormat;
import java.util.ResourceBundle;
import javax.inject.Inject;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;
import org.omnifaces.util.Messages;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@WebListener
public class WebServletListener implements ServletContextListener {
private static Logger log = LoggerFactory
.getLogger(WebServletListener.class);
@Inject
private transient ResourceBundle resourceBundle;
@Override
public void contextDestroyed(ServletContextEvent arg0) {
}
@Override
public void contextInitialized(ServletContextEvent arg0) {
log.info("Hello czetsuya");
log.info("@author: czetsuya@gmail.com");
log.info("-----------------------------------------------");
log.info("Web context starting...");
}
}
Do some initialization work after the web application initialization process
We can achieve this by using a webListener. See code below:
0 nhận xét:
Đăng nhận xét