A servlet can bind an object attribute into an HttpSession implementation by name . Any object bound into a session is available to any other servlet that belongs to the same ServletContext and that handles a request identified as being a part of the same session. Some objects may require notification when they are placed into, or removed from, a session. This information can be obtained by having the object implement the HttpSessionBindingListener interface. This interface defines the following methods that will signal an object being bound into, or being unbound from, a session.
The valueBound method must be called before the object is made available via the getAttribute method of the HttpSession interface. The valueUnbound method must be called after the object is no longer available via the getAttribute method of the HttpSession interface. |