When I start tomcat "contextInitialized(ServletContextEvent)" print.But when I add a value to session (request.getSession().getAttribute("userName","deng") ,the valuebound method didn't trigger.
I don't know why? please give me a help?
this is my web.xml configuration:
this is implements class :
[ August 29, 2007: Message edited by: deng shuangyi ]
Causes an object to be notified when it is bound to or unbound from a session. The object is notified by an HttpSessionBindingEvent object. This may be as a result of a servlet programmer explicitly unbinding an attribute from a session, due to a session being invalidated, or due to a session timing out.
Notice the word "it" is in bold.
Please read carefully what Ben has posted, he has highlighted "it"
Which means, suppose you have a class MyAttribute implementing HttpSessionBindingListener and you do something like
Then the listener will be notified.
Yes you need not declate HttpSessionBindingListener in web.xml