This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have Dawn & David Griffiths on-line!
See this thread for details.
The moose likes Servlets and the fly likes examination system : countdown timer ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "examination system : countdown timer ?" Watch "examination system : countdown timer ?" New topic

examination system : countdown timer ?

Edward Chen
Ranch Hand

Joined: Dec 23, 2003
Posts: 798
I am building a examination system. But I don't know how to implement a timer / clock.

When user is taking an exam, he should have a countdown timer. How to do this ? how to remember the time between jsp pages ? seperate thread to countdown time in server side ?

Thanks in advance .
Daniel Rhoades
Ranch Hand

Joined: Jun 30, 2004
Posts: 186
How about this...

When the user starts the exam create a Date object representing when the exam ends, then save it in the session.

For every request (inc the first) create another Date object representing the current time and save it in the session

Create an applet clock that shows the time difference between the current and the exam end date objects - thats your time left on the exam.

Easy peasy...
[ October 05, 2005: Message edited by: Daniel Rhoades ]

Drinking more tea is the key...
Sravan Kumar
Ranch Hand

Joined: Sep 11, 2005
Posts: 121
Well, if you have the exam sent at one go, that is if the user doesn't have to submit every question, but submits the answers all at once, you have to set the timer in a javascript as depicted here

keep smilin :: sravan<br /><a href="" target="_blank" rel="nofollow">I scribble here</a>
subject: examination system : countdown timer ?
jQuery in Action, 3rd edition