Meaningless Drivel is fun!
The moose likes Struts and the fly likes prevent multiple submission of forms in struts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "prevent multiple submission of forms in struts" Watch "prevent multiple submission of forms in struts" New topic

prevent multiple submission of forms in struts

zoheb siddiqui

Joined: May 08, 2008
Posts: 11
0 down vote favorite
share [fb] share [tw]

i am developing a application in struts 1.3 in struts i have a requirement that when click on the submit button of the form then the button gets disabled so as the user cannot submit the form multiple times for that i am using this code

<input value="Save" class="btnbg" type="submit" name="method"
onclick="this.disabled=true;" />

in this code on click of the button it gets disabled now it is getting disabled but i am facing a peculiar problem that action in the action class is not executing i am using DispatchAction class for execution of my action it code works fine if i remove onclick="this.disabled=true; the action gets executed but i am getting exception

javax.servlet.ServletException: Request[/AddFloor] does not contain handler parameter named 'method'. This may be caused by whitespace in the label text.
Mohana Rao Sv
Ranch Hand

Joined: Aug 01, 2007
Posts: 485

I haven't read carefully your post this is only useful when you are using struts2 - use token session interceptor in you using

ocjp 6 — Feeding a person with food is a great thing in this world. Feeding the same person by transferring the knowledge is far more better thing. The reason is the amount of satisfaction which we get through food is of only one minute or two. But the satisfaction which we can get through the knowledge is of life long.
debraj mallick
Ranch Hand

Joined: Mar 08, 2011
Posts: 188

use token for struts 1
check with isTokenValid() before submitting the form.
I agree. Here's the link:
subject: prevent multiple submission of forms in struts
It's not a secret anymore!