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 duplicate form submission 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 "duplicate form submission" Watch "duplicate form submission" New topic
Author

duplicate form submission

RaviSingh Kumar
Ranch Hand

Joined: Sep 04, 2007
Posts: 52
Hi ,

I am doing a small dumy project in struts. Facing some problem while submitting duplicate form.
1. There is a link "Add Record" which call the dispatchAction class with parameter as "add".
2. In dispatchAction class there is method add() in which i am doing some logic and then fwd the request to form as AddRecord.jsp page.
3. In add() method , added the code saveToken(request) in order to prevent duplicate form submission.
4. When the form is submitted, AddRecordAction is called. In this class we added isValidToken() method.

Problem is that when the form get submitted, the record get added in database and the URL shows as "http://xyz/action.do".When the page get refreshed , the data is not submitted to database.(i.e code is working fine).

But we submit the form with no data, error message is displayed on the form such as "fields marked with * are mandatory".Provide the data and then click on submit the form again. The date doesnot get added to database.

Please let me know how to proceed in this case.

Thanks in advance.

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: duplicate form submission
 
Similar Threads
Double submit problem
Problem in struts DispatchAction
Crazy post and get methods, help....
request scoped form
refresh and back button