Giriş
Şu satırı dahil ederiz
import javax.servlet.http.HttpSessionListener;
Açıklaması şöyle
The HttpSessionListener interface is for receiving notification events about session lifecycle changes. Its implementations are invoked at their sessionCreated method in the order in which they have been declared, and at their sessionDestroyed method in reverse order.Örnek
Şöyle yaparız
import javax.servlet.http.HttpSessionEvent;import javax.servlet.http.HttpSessionListener;import javax.servlet.annotation.WebListener;@WebListenerpublic class MyHttpSessionListener implements HttpSessionListener {@Overridepublic void sessionCreated(HttpSessionEvent event) {System.out.println("session created");}@Overridepublic void sessionDestroyed(HttpSessionEvent event) {System.out.println("session destroyed");}}
Hiç yorum yok:
Yorum Gönder