This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I guess that when the object is atached to the session or dismissed from the session..here by session i mean the user session (request.getSession()) this works...but in your case your are setting it to the ServletContext.
i have not tested this ...so , kindly let me know whether it works for you.
Rahul, this is a plain old Java class (Not a servlet). HtpSessionBindingListener causes an object to be notified when it is bound to or unbound from a session. And this happens when the object is added, replaced or removed from the session. As in SetAttribute, removeAttribute, replaceAttribute.
Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley