File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Time tracking Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Time tracking" Watch "Time tracking" New topic

Time tracking

kiran mahavir
Ranch Hand

Joined: Jan 09, 2001
Posts: 35
A site developed by me, delivers online courses. The problem is, I want to track the user, i.e I want to know the amount of time a user has spent on the lesson.Here I need to consider the following situations
-When the net is disconneted
-When the user closes the browser with out logging out.
(I have planned to implement using the session events and using the setMaxInactiveInterval method, which solves the problem.But in case if the user closes the browser, I wont be able to calculate the time accurately.
And the other problem if i use setMaxInactiveInterval is , in case of online tutorial we cant say how much time a user takes to read a page.
But if i do the above i cant get the exact time.
Is it correct to do this way?)
Please suggest a method for the above task
Thanx in advance
With regards
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 12675
There is no way you can be absolutely sure of catching an event when the user leaves with plain HTML. For example he might just close the internet connection without closing the browser. You might use some sort of invisible Java applet or Javascript function that sends a "keep alive" request to the servlet every X seconds.

author of:

Java Resources at
I agree. Here's the link:
subject: Time tracking
Similar Threads
Ending a "specific" session
Session handling
perform a specific task on logout/closing of browser
How to make user logout when user closes browser window?