tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ralph Einfeldt" <ralph.einfe...@uptime-isc.de>
Subject RE: HttpSessionListener: Negative session count
Date Tue, 12 Aug 2003 08:54:08 GMT
You don't need the useBean.

A bean with session scope doesn't make sense at all,
if you want to access the methods through an object
you can make the object application global.

Or you can make sessionCreated/sessionDestroyed
static and just call them through the class.


> -----Original Message-----
> From: Christian Hauser [mailto:c.hauser@active.ch]
> Sent: Tuesday, August 12, 2003 10:47 AM
> To: Tomcat Users List
> Subject: Re: HttpSessionListener: Negative session count
> 
> 
> Is it correct that I don't have to use
> <jsp:useBean id="sessionCounter" class="SessionCounter" 
> scope="session" />
> and set the scope to "session"?
> 
> Because now I don't use "useBean". Should I?
> 
> >     private static int activeSessions = 0;
> > 
> >     public void sessionCreated(HttpSessionEvent event) {
> >       activeSessions++;
> >     }
> > 
> >     public void sessionDestroyed(HttpSessionEvent event) {
> >       activeSessions--;
> >     }
> > 
> >     public static int getActiveSessions() {
> >       return activeSessions;
> >     }

Mime
View raw message