• 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
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Stephan van Hulst
  • Ron McLeod
  • Tim Moores
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Vijitha Kumara

Database replecation from Jsp  RSS feed

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all i am new member in this gerate site.

can any body help me in this problem.
i have project in jsp (dynamic creation for questions)which generate a web site and make rigisteration for user, which accepet his name, subject for the questions, number of questions that he want to cereate them and number of those questions.

the problem when the user access this web site and fill out the form and click submit he got the questions succefully but the problem is when the user click referish on the current page, the publisher got replication in the database.

method i used in the form is post
and my database is MySQL
 
author & internet detective
Posts: 39195
725
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sultan,
You need to code a technique to prevent the same request from being sumbmitted twice. A common approach uses a token in the session. When the user views the form to add data, you put a token (like a String) in the HttpSession. Then when the user presses submit you have your servlet/jsp check for the token's presence. If the token is there, you update the database and delete the token. If the token is not there, it is a duplicate request.

Another alternative is to use a database key to check for a duplicate submisssion. You could put a hidden field with the time in the form. Then when the form is submitted, see if that is the same value in the database.
 
please buy my thing and then I'll have more money:
global solutions you can do in your home or backyard
https://coderanch.com/t/708587/global-solutions-home-backyard
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!