JavaWeb- other Listener Listener (2)

Session-aware binding event listeners

* Session object is stored in a domain can have multiple states:

    "Bound to the Session; domain unbound from the Session; (1) with the Session object persistence to a storage device; (2) with a Session object from the storage device to restore .

* Servlet defines two interfaces help JavaBean objects understand their domain of these states Session :

  HttpSessionBindingListener interfaces and interfaces HttpSessionActivationListener

  Web.xml files do not need to register the class implement both interfaces in

 

HttpSessionBingdingListener接口

* Achieved JavaBean objects HttpSessionBingdingListener interface may perceive themselves to be bound to the Session events in and removed from the Session

* When an object is bound to the HttpSession object, web server calls the object's void valueBound (HttpSessionBindingEvent event) Method

* When an object unbound from the HttpSession object, web server calls the object's void valueUnbound (HttpSessionBindingEvent event) method

 

HttpSessionBindingEvent:

getName()

getValue()

getSession()

 

The listener is invoked less

 

Guess you like

Origin www.cnblogs.com/yangHS/p/11220663.html