File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Submitting a JSP page after a predefined Time limit

 
Anshul Mathur
Greenhorn
Posts: 22
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All

I am making an online QUIZ for my College and want to include the feature that page automatically submits to a servlet/JSP after the time limit is exhausted.

Thanks

Anshul Mathur
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is one of the examples in my book that I am writing.

You need to use a setTimeout() method, basic idea

onload="setTimeout('document.formName.submit()',numMilliseconds)";

Eric
 
Gaurav Jain
Ranch Hand
Posts: 108
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use the setTimeout() function of javascript.
Call the submit function from setTimeout and the page will b submitted after the predefined time limit.

setTimeout('yourFunction()',3000)
3000 is time in millisecinds.
Call the setTimeout function based on your condition/requirement.
 
Anshul Mathur
Greenhorn
Posts: 22
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot.
 
Yuriy Fuksenko
Ranch Hand
Posts: 413
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Keep in mind , that if user have access to address bar he could change that time thing.
For Erics example

If I type in address bar:

the page will be submited only after I type in address bar
 
Saumyaraj Zala
Ranch Hand
Posts: 56
Android Java Netbeans IDE
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a similar problem.
A user can finish quiz by clicking submit button or it will be submitted after a predefined time out.
Where to call the javascript method ontimeout?
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Attach it to the window load event.

  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic