Reputation: 36759
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?
Upvotes: 0
Views: 497
Reputation: 30448
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);
Upvotes: 2