This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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 Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "prevent multiple submission of forms in struts" Watch "prevent multiple submission of forms in struts" New topic
Author

prevent multiple submission of forms in struts

zoheb siddiqui
Greenhorn

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.
org.apache.struts.actions.DispatchAction.unspecified(DispatchAction.java:197)
org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:245)
org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:170)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:425)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:228)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462)
javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
com.asset.filter.CheckSession.doFilter(CheckSession.java:72)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)
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 http://struts.apache.org/2.1.6/docs/token-session-interceptor.html


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.
 
Don't get me started about those stupid light bulbs.
 
subject: prevent multiple submission of forms in struts
 
Similar Threads
Struts error
onclick="this.disabled=true;"
Probelom in Manual Validation method
Dispatch Error Action
LookupDispatchAction: missing resource in key method map