Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Values are re-inserted on refresh

Status
Not open for further replies.

softjack

Programmer
Dec 4, 2005
44
IN
Hi,
i'm using jsp inside a JAVA script function to insert records in Oracle database.
Every thing looks perfect until i hit the refresh button on my browser.

Each time i hit refresh, duplicate values r inserted in the database.

How can i avoid that?

thanx

softjack
 
Hi

softjack said:
jsp inside a JAVA script function
I never heard suck thing.

But your problem is a common one. Some possible workarounds :
[ul]
[li]redirect the browser to another page[/li]
[li]reset the form after submit[/li]
[li]note in a session variable that the given page already sent data and reject all further[/li]
[li]check in the database for similar data[/li]
[/ul]

Feherke.
 
It reallty is a very bad idea to use client-side code to do derver-side work. I wouldn't use work-arounds but change my code. The least you must do IMO is to direct this work to a Servlet which will do the INSERT instead of javascript.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top