I am having a session variable whose value can be changed from java and from Jsp as well. Is it possible to detect when this variable's value is changed?
+2
A:
You can implement the HttpSessionAttributeListener and you will get notification every time the value is replaced. Notice that in the following cases (which is highly not recommended) it won't work:
MyObject myobj = (MyObject)session.getAttribute("obj");
myobj.setValue(newValue);
David Rabinowitz
2009-10-27 12:00:39