File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "duplicate form submission" Watch "duplicate form submission" New topic

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/".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:
subject: duplicate form submission
It's not a secret anymore!