File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Number of users Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Number of users" Watch "Number of users" New topic

Number of users

Pankaj Kumarkk
Ranch Hand

Joined: Apr 17, 2011
Posts: 110
I have requirements in my application to show below:
1. Number of active users
2. Number of users who accessed the web site

I have searched the code ranch forum and googled and have below questions.

For 1. Number of active users
I am thinking of counting the number of active sessions using HttpSessionListener. The only question was how to account for users who do not login and thus there is no session created for them.

For 2. Number of users who accessed the web site
Persist a count in DB to store the number of users in a app_statistics table. This approach can account for requirement 1) also.
I think it might be doing too much for a small requirement. But I would like to hear what other people have to say and how they have handled it in their applications.
I agree. Here's the link:
subject: Number of users
jQuery in Action, 3rd edition