DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 8 of 8
  1. #1
    Join Date
    May 2004
    Posts
    6

    Getting No: and User Detals of Active Users

    Hi

    I have one web application and i want to get the number of users who are currently accessing the application.

    Also I want to get the user details of each user, which is stored in a database.

    How can I do this? Pls help.

    Regards
    Mary

  2. #2
    Join Date
    Nov 2004
    Location
    Norway
    Posts
    1,560
    Your web host may have a free setup for that, like a html snippet that you insert
    into your web page, at least mine (start.no) has.
    If that is not an option you will have to have a cgi-script/servlet/php on the server
    that your web app can access for counting.

  3. #3
    Join Date
    May 2004
    Posts
    6

    In JSP

    But i am using Java/JSP/MySQL

    --
    Mary

  4. #4
    Join Date
    Oct 2004
    Posts
    311
    Easiest way would be to have a table in your database which records all user activity. Each time a user accesses a page, update the date field. then, when you want to count the active users, just count the number of records with a date within the last 5 minutes.

  5. #5
    Join Date
    May 2004
    Posts
    6

    Better way

    Yes. Now i am doing it using table.
    But i need some better way of doing it.


    Mary.

  6. #6
    Join Date
    Oct 2004
    Posts
    311
    You could try a class with a static attribute.
    but then it would be fairly difficult to account for people not being active for a certain period of time. If you manage to incorporate that, it should work.

  7. #7
    Join Date
    May 2004
    Posts
    6
    But still v need to have table, right? or is it any other method? If so cud you pls explain in detail?

  8. #8
    Join Date
    Nov 2004
    Location
    Norway
    Posts
    1,560
    As I recall, a servlet is not loaded each time a client accesses it, the servlet stays
    memory resident after first invokation so a static variable will be "user global", and
    also reset when the server is restarted.
    One partial solution could be cookies, but not all clients accept them. I would go for
    a very simple table solution: add all traffic to the table, and on certain intervals do
    a "cleanup" eliminating multiple accesses made by the same user(s). This action could
    be controlled by a class variable that would spawn a cleanup-process on the server
    at, say, every 500 access made.
    eschew obfuscation

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links