Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

how to prevent double submission?

 
Ranch Hand
Posts: 261
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Marshal
Posts: 67451
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check out this article, and pay particular attention to the P-R-G pattern.
 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
use tokens it's simple ;check this link http://www.learntechnology.net/content/struts/struts_token.jsp
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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..........
 
Ranch Hand
Posts: 643
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

The code above is complete example for resubmit of button.
 
Die Fledermaus does not fear such a tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic