This week's book giveaway is in the Testing forum.
We're giving away four copies of Practical Unit Testing with TestNG and Mockito and have Tomek Kaczanowski on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes Submitting a JSP page after a predefined Time limit Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of Practical Unit Testing with TestNG and Mockito this week in the Testing forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Reply Bookmark "Submitting a JSP page after a predefined Time limit" Watch "Submitting a JSP page after a predefined Time limit" New topic
Author

Submitting a JSP page after a predefined Time limit

Anshul Mathur
Greenhorn

Joined: Nov 07, 2003
Posts: 22
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

Joined: Nov 08, 2001
Posts: 15003
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

Joined: Mar 11, 2004
Posts: 108
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

Joined: Nov 07, 2003
Posts: 22
Thanks a lot.
Yuriy Fuksenko
Ranch Hand

Joined: Feb 02, 2001
Posts: 411
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
 
 
subject: Submitting a JSP page after a predefined Time limit
 
Threads others viewed
Time limit to take the part 2
Limit of JSP page to Compile
Time limit of part II
to make a page submit itself after a predefined time limit.
JSP Truncation
developer file tools