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 Time tracking 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 "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: 12761
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:
It is sorta covered in the JavaRanch Style Guide.
subject: Time tracking
Similar Threads
Session handling
perform a specific task on logout/closing of browser
How to make user logout when user closes browser window?
Ending a "specific" session