Can I use session.getAttribute() in sessionDestroyed
It seems that I can't.I got NullPointerException.If no,How can I getAttribute BEFORE sessionDestroye开发者_高级运维d when it is going to be dstroyed?
Normally the session still holds the attributes when passed through the HttpSessionEvent parameter to sessionDestroyed. What you should check is if there is another SessionListener in your application which empties your session. Remember that session listeners can also be declared in a TLD.
For example Woodstock JSF components have a SessionListener declared somewhere in a TLD.
If you find such a case remove the SessionListener from the TLD and move it to your web.xml in the order you want.
I would recommend though to create an empty web application with no additional libraries first in order to have a clear image. I am pretty sure that the attributes should be there.
精彩评论