AndiArt wrote:
> I developed a monitoring for my web programm, which shows, which users
> are online. For that reason, if I log in or log out, an entry is made
> into and deleted from the database. But if the session expires, it
> should also delete the corresponding entry from the database.
> I used a javax.servlet.http.HttpSessionActivationListener but it
> doesn't work. I'd like to show you my source code:
> public class SessionPassivateListener implements
> HttpSessionActivationListener {
>
> @Override
> public void sessionDidActivate(HttpSessionEvent arg0) {
>
> }
>
> @Override
> public void sessionWillPassivate(HttpSessionEvent evt) {
> <listener>
> <listener-class>
> de.hc.listener.SessionPassivateListener
> </listener-class>
> </listener>
>
> <session-config>
> <session-timeout>1</session-timeout>
> </session-config>
You need to implement HttpSessionListener with sessionCreated
and sessionDestroyed and maintain a HashMap or similar around with
the users.
http://saloon.javaranch.com/cgi-bin/...&f=50&t=005749
http://forum.java.sun.com/thread.jsp...sageID=2609106
shows some code fragments.
Arne