Giriş
Şu satırı dahil ederiz
import javax.servlet.http.HttpSessionActivationListener;
Açıklaması şöyle
Objects that are bound to a session may listen to container events notifying them that sessions will be passivated and activated. A container that migrates sessions between VMs or persists sessions is required to notify all attributes bound to sessions implementing the HttpSessionActivationListener interface.Örnek
Şöyle yaparız
import java.io.Serializable;import javax.servlet.http.HttpSessionEvent;import javax.servlet.http.HttpSessionActivationListener;public class MyHttpSessionActivationListener implements HttpSessionActivationListener,
Serializable {@Overridepublic void sessionDidActivate(HttpSessionEvent event) {System.out.println("session activated");}@Overridepublic void sessionWillPassivate(HttpSessionEvent event) {System.out.println("session passivated");}}
Hiç yorum yok:
Yorum Gönder