gudii9
asked on
HttpSessionAttributeListener getAttribute vs getValue
Hi,
I am reading about HttpSessionAttributeListen er as follows
I wonder what it mean by old value and new value and why we need to get old value.
when and why we use HttpSessionAttributeListen er in practical applications.
Please advise.
Any links resources ideas highly appreciated. Thanks in advance
I am reading about HttpSessionAttributeListen
attributeAdded method called when a new attribute name is first added to a session.
attributeReplaced method called when a new value is assigned to an existing name. attributeAdded is not called in this case.
To obtain old value use event.getValue and to obtain new value is use session.getAttribute.
In my ListenerDemo class method I only see getValue() but do not see getAttribute()
public void attributeAdded(ServletContextAttribu teEvent arg0) {
System.out.println("Attribute Added");
System.out.println("old"+arg0.getVal ue()); (i wasable to see getAttribute on arg0)
System.out.println("new"+arg0.getAtt ribute()); (not able to see getAttribute on arg0???)
}
I wonder what it mean by old value and new value and why we need to get old value.
when and why we use HttpSessionAttributeListen
Please advise.
Any links resources ideas highly appreciated. Thanks in advance
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.