This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Servlets and the fly likes number of users online Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "number of users online" Watch "number of users online" New topic
Author

number of users online

Meet Gaurav
Ranch Hand

Joined: Oct 08, 2008
Posts: 492
How to find the numbers of users accessing the static webpage, I dont have any sessions in my site, All are simple html static pages. Is there any way to identify this using Javascript
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41155
    
  45
JavaScript runs on the client, so it can't help with this.

You don't need sessions to keep track of page hits. You could use a servlet filter that stores page hits in a Map (URL -> number of hits) that's stored in the web app context.


Ping & DNS - my free Android networking tools app
Nishan Patel
Ranch Hand

Joined: Sep 07, 2008
Posts: 684


Hi,


HTML static page not contains any dynamic data and using java script you can not count user which are access your application.

You have to use some server side technology for support your requirement.



Thanks, Nishan Patel
SCJP 1.5, SCWCD 1.5, OCPJWSD Java Developer,My Blog
Duc Vo
Ranch Hand

Joined: Nov 20, 2008
Posts: 254
Meet Gaurav wrote:How to find the numbers of users accessing the static webpage, I dont have any sessions in my site, All are simple html static pages. Is there any way to identify this using Javascript

You should be able to parse the information from the server log files. Now depending on what is your definition of "accessing" (i.e. last serving page is within 5 mins), you can calculate the number.


“Everything should be as simple as it is, but not simpler.” Albert Einstein
Mohamed Inayath
Ranch Hand

Joined: Nov 22, 2004
Posts: 124
Duc Vo wrote:
You should be able to parse the information from the server log files. Now depending on what is your definition of "accessing" (i.e. last serving page is within 5 mins), you can calculate the number.


Hey, Why one has to parse the logs to get the user count??
Duc Vo
Ranch Hand

Joined: Nov 20, 2008
Posts: 254
Mohamed Inayath wrote:
Hey, Why one has to parse the logs to get the user count??

When one doesn't want to or have any appserver technology running. Btw, what problem are you trying to solve and/or what solution are you offering?
Mohamed Inayath
Ranch Hand

Joined: Nov 22, 2004
Posts: 124
Duc Vo wrote:
When one doesn't want to or have any appserver technology running. Btw, what problem are you trying to solve and/or what solution are you offering?


I believe the question is to count the number of users who are online using javascript?

For which answer is NO.

Possible solution could be done on the serverside using either the Filter or the SessionListener.

Again, if these options are available why one has to parsing the logs



 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: number of users online
 
Similar Threads
ValueListHandler and cahing
Multiple users accessing same method..
Theoretical Finger
J2EE, how to let users know, that application is down
Session count tracking is lost when Tomcat restarted