Using Jigsaw, W3C's Server, I have to find out how many sessions are there at a given time. Any help will be greatly appreciated
Created May 7, 2012
Now in the JSP pages, at the top, check if the User object exists in the Session scope. If it doesn't, create one and add it to the Session. This will automatically call the valueBound on that object and increment the counter. When a persons session expires, or the User object is removed from the session, the valueUnbound is automatically called and the counter decrements.
I usually make this check a seperate JSP page which I include on all the other pages. Then all you need to do is get the User.counter value at any time to see how many people are on the system.
The only problem with this is that it takes 30 mins of inactivity for a session to expire, but most web servers allow you to change this value.
If you need some code examples, email me privately and I'll send you them.