• Post Reply Bookmark Topic Watch Topic
  • New Topic

Count visitors  RSS feed

 
Erik Pragt
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello!
It there a way to count the number of visitors currently on a JSP page? I know how to increment the counter, but I can't figure out how to detect if the visitor has has left the page and thus decreasing the counter by one.
Can anyone help me with that?
Erik
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since HTML is basically a state-less protocol, there is nothing corresponding to "leaving a page" built in. You could do some sort of kludge with a JavaScript "pulse", but is it worth the trouble?
What you could do is some sort of JavaBean with application scope that tracks the date/time of the last N visitors in addition to counting totals per day, etc etc. - it could save state by serializing itself out to a file.
Bill
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!