This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates 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 OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP 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.

 
 
subject: duplicate form submission