开发者

Can I use session.getAttribute() in sessionDestroyed

开发者 https://www.devze.com 2023-02-13 21:45 出处:网络
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 wh

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消