HttpSessionAttributeListener getAttribute vs getValue


I am reading about  HttpSessionAttributeListener as follows

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(ServletContextAttributeEvent arg0) {
            System.out.println("Attribute Added");
            System.out.println("old"+arg0.getValue()); (i wasable to see getAttribute on arg0)

                      System.out.println("new"+arg0.getAttribute()); (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 HttpSessionAttributeListener in practical applications.

Please advise.

Any links resources ideas highly appreciated. Thanks in advance
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

System.out.println("new"+arg0.getAttribute()); (not able to see getAttribute on arg0???)
You need to use session.getAttribute. The ServletContextAttributeEvent does not have a getAttribute method.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.