JSP submitting after a certain time

Hi Experts,

May I ask how to submit a page without clicking a button or whatsoever...   just time controlled if possible...

A sample code would be best...

Thanks in advanced experts...!    =)
Who is Participating?
lhankinsConnect With a Mentor Commented:
just use some javascript with the setTimeout function, for example, the following will cause the form to be submitted 3 seconds after the page has fully loaded (this is setup in the initUi() method which is called by the document.onload handler). :


<script type="text/javascript">

function doSubmit()
   alert("submitting form");

function initUi()
   setTimeout("doSubmit();", 3000);


<body onload="initUi()">
   <form action="/actions/doSomething">

      <input type="text" value="some value"/>


The short answer...You cant.

Here are some options though..
   -You could set the page to refresh to a new URL after N seconds
   -You could setup an event handler on mousemove, keydown, etc.  and implement a timer there
     var pageStart=new Date()
     function onMouseMove()
        var now=new Date();
        var delta=now.getTime()-pageStart.getTime()
        if (delta>60000)
sorry, forgot about the setTimeout.  That would work too
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.