You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by password password <be...@yahoo.es> on 2005/07/11 18:42:46 UTC
Problem when a click a button that it execute a servlet "n" times
Hi,
I have a problem with a button in my jsp page. When I click the button then it excutes a servlet. But if i click two or three or n times it executes a servlet
"n" times.
How can I do that this button execute only once independent of the number of times that you click the button.
Thanks.
---------------------------------
Correo Yahoo!
Comprueba qué es nuevo, aquí
http://correo.yahoo.es
Re: Problem when a click a button that it execute a servlet "n" times
Posted by password password <be...@yahoo.es>.
My problem is that I can not disable the button because when the user click the button the application return a file to the user. And when the process has finished then the user have to can download other file.
The button does the next (call a servlet):
- Process the inserted information by the user.
- Store this information in a oracle database .
- Finally, return a file to the user (download).
The user always is in the same jsp page. In the page the user enter a lot of information, and the idea is the user can download various files.
I can not refesh the page because I lose the entered information by user.
If I disable the button the user can not download other file because the button is disabled.
I don't know how do it without disabling the button.
Could I disable the button when the user click the button and could I enable when the user has download the file? How?
Michael Jouravlev <jm...@gmail.com> escribió:
On 7/11/05, Frank W. Zammetti wrote:
> If you are not script-averse, the solution to this that I've always used
> is to disable the button client-side before submitting the form.
>
> It's not a perfect solution though, as there is no way to re-submit if a
> problem occurs (i.e., if it hangs for a long time... outright
> server-side errors would still occur as usual of course), but in many
> situations it's fine. Note that PayPal is one example of a major site
> that does this.
>
> Frank
I agree, something like this works pretty well, but you still need to
check for resubmits, if resubmitting must not be allowed at all.
function SubmitForm(){
document.getElementById('sub').disabled = true;
document.forms['msgform'].submit();
return true;
}
...
[input] name="param_submit" value="Submit This Form" />
Michael.
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
---------------------------------
Correo Yahoo!
Comprueba qué es nuevo, aquí
http://correo.yahoo.es
Re: Problem when a click a button that it execute a servlet "n" times
Posted by Michael Jouravlev <jm...@gmail.com>.
On 7/11/05, Frank W. Zammetti <fz...@omnytex.com> wrote:
> If you are not script-averse, the solution to this that I've always used
> is to disable the button client-side before submitting the form.
>
> It's not a perfect solution though, as there is no way to re-submit if a
> problem occurs (i.e., if it hangs for a long time... outright
> server-side errors would still occur as usual of course), but in many
> situations it's fine. Note that PayPal is one example of a major site
> that does this.
>
> Frank
I agree, something like this works pretty well, but you still need to
check for resubmits, if resubmitting must not be allowed at all.
<script language="JavaScript">
function SubmitForm(){
document.getElementById('sub').disabled = true;
document.forms['msgform'].submit();
return true;
}
</script>
<form action="..." method="post" name="msgform" id="msgform">
...
<input id="sub" type="submit" onclick="SubmitForm();"
name="param_submit" value="Submit This Form" />
</form>
Michael.
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: Problem when a click a button that it execute a servlet "n" times
Posted by "Frank W. Zammetti" <fz...@omnytex.com>.
If you are not script-averse, the solution to this that I've always used
is to disable the button client-side before submitting the form.
It's not a perfect solution though, as there is no way to re-submit if a
problem occurs (i.e., if it hangs for a long time... outright
server-side errors would still occur as usual of course), but in many
situations it's fine. Note that PayPal is one example of a major site
that does this.
Frank
Mitchell Teixeira wrote:
> I was just reviewing an article which addresses this exact issue!
>
> http://java.sun.com/developer/EJTechTips/2003/tt0114.html
>
> I hope this helps - it doesn't look simple, but neither is your issue! I
> think the only situation to your issue is from an application point of
> view rather than from Tomcat.
>
> Cheers -
> MitchellT
>
>
>
> --- password password <be...@yahoo.es> wrote:
>
>
>>Hi,
>> I have a problem with a button in my jsp page. When I click the button
>>then it excutes a servlet. But if i click two or three or n times it
>>executes a servlet
>> "n" times.
>>
>>How can I do that this button execute only once independent of the
>>number of times that you click the button.
>>
>>Thanks.
>>
>>
>>
>>---------------------------------
>>
>>Correo Yahoo!
>>Comprueba qué es nuevo, aquí
>>http://correo.yahoo.es
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
>
>
>
--
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: Problem when a click a button that it execute a servlet "n" times
Posted by Mitchell Teixeira <te...@yahoo.com>.
I was just reviewing an article which addresses this exact issue!
http://java.sun.com/developer/EJTechTips/2003/tt0114.html
I hope this helps - it doesn't look simple, but neither is your issue! I
think the only situation to your issue is from an application point of
view rather than from Tomcat.
Cheers -
MitchellT
--- password password <be...@yahoo.es> wrote:
> Hi,
> I have a problem with a button in my jsp page. When I click the button
> then it excutes a servlet. But if i click two or three or n times it
> executes a servlet
> "n" times.
>
> How can I do that this button execute only once independent of the
> number of times that you click the button.
>
> Thanks.
>
>
>
> ---------------------------------
>
> Correo Yahoo!
> Comprueba qué es nuevo, aquí
> http://correo.yahoo.es
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org