File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes problem with actions in servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "problem with actions in servlet" Watch "problem with actions in servlet" New topic

problem with actions in servlet

sitaram irrinki
Ranch Hand

Joined: Feb 16, 2005
Posts: 158
there is a form which contains some fields and at the end there is submit button. so when we press the submit buttion the data will be entered into the database. here some times the user will be clicking the submit button twice or thrice(may be in a hurry or unfamiliar user).if it is the case the data will be entered twice or there is a chance of duplicate data. so how to avoid this double clicks(in servlets).
Santhosh Kumar
Ranch Hand

Joined: Nov 07, 2000
Posts: 242
One option is to, show a alert msg moment user clicks on the button, and asks for confirmation. This would ensure that, they would not click twice. Then if they confirm to submit, before submitting the form, disable the button. I think this is what most of the pages do.
Jeffrey Spaulding
Ranch Hand

Joined: Jan 15, 2004
Posts: 149
We disable the button via javascript once the user clicks it.
Since we repaint the page in our answer we have a brandnew working button when the cycle is finished and the user is allowed to press again.
I agree. Here's the link:
subject: problem with actions in servlet
It's not a secret anymore!