• Post Reply Bookmark Topic Watch Topic
  • New Topic

duplicate entries  RSS feed

 
McCoy Agt
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


hello everyone,

my question is,

i have a jsp page having some fields, and connectivity with MySQL.
it save entries to database easily but if i reload my page by clicking on web page reload icon my page asks for re-submission, if i continue it it saves last entries to database itself again. thus my saves duplicate entries...

i am new in java programming, so please help me out friends...

how can i fix that problem...

thank you everyone...
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66144
144
IntelliJ IDE Java jQuery Mac Mac OS X
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please read this article and pay special attention to the PRG pattern.
 
Bharat Sankannanavar
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you reload the page, the code present in the page will execute once again, thats why the same entries inserting another time in your database.
Provide your TABLE details here so that we can see how can we get it solved.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66144
144
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The solution is in the article I linked to above. The request and response structure must be coded such that a refresh in the browser does not replay the action.

The details of the table are not germane to this issue.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!