This week's book giveaway is in the HTML Pages with CSS and JavaScript forum.
We're giving away four copies of React Cookbook: Recipes for Mastering the React Framework and have David Griffiths & Dawn Griffiths on-line!
See this thread for details.
Win a copy of React Cookbook: Recipes for Mastering the React Framework this week in the HTML Pages with CSS and 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Rob Spoor
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Holloway
  • Piet Souris
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Frits Walraven
  • Himai Minh

duplicate records

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
when i am creating a record like inserting a record then if i refresh a page same record get inserted again . I am auto incrementing Emp Id. which is a primary key.
but other than that everything else is duplicating.

please reply

Supriya
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When you are refreshing a page the http event like "/addemployee.do" (assuming
struts flow) is getting fired again as before refreshing the page the
url which made employee record insertion before page refresh is still there
in browsers address bar.There couldn't be new entry if you were editing existing field , I mean "/editemployee.do" kinda functionality.
Whatever happening is quiet natural only instead of you clicking on "submit"
button and in turn it resulting into corresponding action(in this case /addemployee.do)browser directly firing this http event.
But why do you need to refresh your pade anyway?
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Did you use empid as a primary key or composite primary key?
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Shrikant Kesarkar:
... (assuming
struts flow)



We don't assume that Struts is being used unless the original poster says it is.
 
supriya ratnakar
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yes emp id is primary key and i am just using mvc not struts
 
Ranch Hand
Posts: 1325
Android Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you can handle this problem by using a flag before inserting the row into the database and then false this flag after insertion.

is this help.
 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi supriya,

you can solve that problem by redirecting the action to some other page.
In that page you again redirect to your page (whichever you need).



you redirect your actual page to some other page like what i have did and in that page you mention the next page action.

try it
;)
 
My name is Inigo Montoya, you killed my father, prepare to read a tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic