tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Frank W. Zammetti" <>
Subject Re: Problem while submiting the page
Date Fri, 28 Jul 2006 14:10:01 GMT

I think you might be running into a timing issue.  I would suggest 
this... onClick of the button, first, disable the button, and then set a 
timeout, set for like 1 millisecond (which is probably a lower 
resolution than is available, but it will basically fire immediately, 
that's what you want).  Do the submission to the first action.  Then, in 
that timeout function, start another timeout for maybe 500 millisecond. 
  When it fires, make the second submission.  I'm guessing that the 
first request doesn't begin before the code starting the second one 
fires.  This timeout scheme should avoid that.

Alternatively, have another form on the page with ll the same elements, 
but hidden.  Then just have a bit of Javascript to iterate over the 
elements of the real form and transfer them to the second form.  Then 
just submit both forms, each one targeting a different action.

One other option, and probably the one I'd go for myself, is instead of 
submitting the form at all, make two AJAX requests, one to each action. 
  The submit button would be an ordinary button to avoid its own submit 
getting in the way.  It would be a little more work on your part, since 
you have to handle the response, but any of the libraries available 
today will make it childs' play.


Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
AIM/Yahoo: fzammetti
Author of "Practical Ajax Projects With Java Technology"
  (2006, Apress, ISBN 1-59059-695-1)
Java Web Parts -
  Supplying the wheel, so you don't have to reinvent it!

Prafulla Nawale wrote:
> Hi,
> I am facing one problem on submit of jsp.
> I think its most probably an issue related to javascript. Can you please help me in figuring
out it.
> There is a button on the screen, on click of that button i invoke the javascript function
and in that function i submit the form two times, to two different actions.
> So what happens mostly in this case is only the second action is executed. I can see
the log corresponding to second action only. 
> Can anyone please help me in solving this.
> the code snippet in js is like this
> var win ="", "checklist", features);
> = "checklist";
> document.formMain.action = '../..' + actionPath + '/' + link + '?uniqeId='+uniqeId +
'&ref=' + refName;
> document.formMain.submit();
> = "checklist";
> document.formMain.action = '../../PrintOut/Polling/'+uniqeId + '&ref='
+ refName;
> document.formMain.submit();
> ---------------------------------------------------------------------
> To start a new topic, e-mail:
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To start a new topic, e-mail:
To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message