This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
SessionBindingListener is used to notify the objects, which is going to bound with the session or unbound from the session.
If you are using going to include the customer object in the session, then session.put() method will indirectly invoke the customer (object's valueBound method) which implements this SessionBindingListerner. Similarly while removing customer object from the session, the valueUnbound() method is called.
Basically this listeners are used to notify the object to perform some operation before joining to /after coming out from session scope.
Joined: Jan 16, 2001
Thanks to both for the reply. I would like to know whether there is any way to push the servlet content automatically when some event happens.
Eg: In case of chat if any message is there for the user received in the DB, how do make it visible to the user other than constant refresh of the Page.
hi The standard javax.servlet.http package provides the HttpSessionBindingListener interface and HttpSessionBindingEvent class to manage session-scoped resources. A JSP page must appropriately manage resources acquired during its execution, such as JDBC connection, statement, and result set objects. for example, acquire a database cursor when the bean is instantiated and close it when the HTTP session is terminated.
These methods are called by the servlet container--the valueBound() method when the object is stored in the session; the valueUnbound() method when the object is removed from the session or when the session times-out or becomes invalid.