The moose likes HTML, CSS and JavaScript and the fly likes Timer in mock exam Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Timer in mock exam" Watch "Timer in mock exam" New topic

Timer in mock exam

Dilshan Edirisuriya
Ranch Hand

Joined: Apr 22, 2006
Posts: 299
Im developing a mock exam engine in jsp. In my quesiion jsp pages i want to add a timer. Can somebody help me to fulfil my requiremrnt.
Thank you

Dilshan Edirisuriya SCJP1.4, SCWCD1.4, SCBCD 5
Eric Pascarello

Joined: Nov 08, 2001
Posts: 15385
Use setTimeout/setInterval

Garrett Smith
Ranch Hand

Joined: Jun 27, 2002
Posts: 401
A design/engineering question.

Relying on a timer solely on the client could be a problem because someone might hack it (to give the quiz-taker more time) and make a bookmarklet out of the hack.

If it's at a kiosk that is not on the internet, you won't have to worry about that problem. If it's on the 'net, you have to take measures.

You could have a timer on the server and use keep-alive. Alternatively, you could consider a combined approach, using a timer on the server and something on the client (setTimeout, or http refresh or http redirect).

comp.lang.javascript FAQ:
Dilshan Edirisuriya
Ranch Hand

Joined: Apr 22, 2006
Posts: 299
Thank you Garrett. But im not clear about how to implement your idea. can you please tell me an alternative for that.
I agree. Here's the link:
subject: Timer in mock exam
It's not a secret anymore!