Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem with actions in servlet

 
sitaram irrinki
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 thrice.so there is a chance of duplicate data. so how to avoid this double clicks(in servlets).
 
Santhosh Kumar
Ranch Hand
Posts: 242
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 149
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic