Struts Session Listener

Hello,

Is there already functionality within the Struts framework for the use of session listeners, or would this be something that would have to be coded and added to the application?

I would like to resolve a very common issue, that of users closing their browser without logging out, and am very new to Struts....

[335 byte] By [angrycata] at [2007-11-26 14:33:49]
# 1

No, there is nothing in struts specifically for Session Listeners.

You would have to write your own.

My suggestion would be to have one of your objects implement the interface HttpSessionBindingListener.

Anytime that object is put into a session/removed from session it fires an event.

If you make it a "User" object, which gets set on Login, and removed on logout you then have events for Login/Logout/Timeout actions.

evnafetsa at 2007-7-8 2:29:45 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

Thanks Enafets,

I think I may have made a mistake in thinking I can use a session listener to run a logout routine.

I know I can detect the session time out, but, at the point the event is triggered have session variables already been disgarded?

When the event is triggered I would need to retreive user information from the session to run the logout routine, I am now thinking that as the session has already timed out, session variables will have been disgarded?

Thanks

Message was edited by:

angrycat

angrycata at 2007-7-8 2:29:45 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...