File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes how to prevent double submission? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "how to prevent double submission?" Watch "how to prevent double submission?" New topic
Author

how to prevent double submission?

Simpson Kumar
Ranch Hand

Joined: Mar 19, 2008
Posts: 261
we have a school list site and its developed under struts framework.

in my application, I have created school list and stored them into database.
when I clicked on the back button (browser back), and once again the application is saving the same data. so its a bad approach. how can I prevent storing

the url after I saved : - http://localhost:9080/SchoolListBuilder/saveSchoolList.do
and immediately the success view is showing correctly. when i click on the back button the warning page is displaying "Warning: Page has Expired" and i refresh that page, once again the data is storing with the same data into database.

what type of approach i need to follow to prevent double submission?


Thanks,
Kumar
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61766
    
  67

Check out this article, and pay particular attention to the P-R-G pattern.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
mahmoud allam
Greenhorn

Joined: Aug 26, 2006
Posts: 24
use tokens it's simple ;check this link http://www.learntechnology.net/content/struts/struts_token.jsp


Mahmoud Allam<br /> <br />SCJP 1.5<br />SCWCD 1.4
Dipali Selukar
Greenhorn

Joined: Apr 18, 2008
Posts: 2
The duplicate form submission occurs

-When a user clicks the Submit button more than once before the response is sent back or
- When a client accesses a view by returning to a previously bookmarked page.
Read More..........
Gowher Naik
Ranch Hand

Joined: Feb 07, 2005
Posts: 643

The code above is complete example for resubmit of button.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to prevent double submission?