Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

JSP SQL insert refresh button problem

Posted on 2003-03-24
10
Medium Priority
?
224 Views
Last Modified: 2011-09-20
Hi,

I have got a Javabean to input data from text fields from a JSP into an Access database.

When I do a select statement to see what has been entered in the database everything is displayed, however when I press the refresh button on the browser a new entry is made into the database after the message resending the information, inputting exactly the same data that I have just entered on the JSP form page.

Any idea of how to overcome this problem?

   
0
Comment
Question by:superstyled
  • 4
  • 2
  • 2
  • +2
10 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 8198373
Save a flag in the session to indicate the update has been done. Read the flag to prevent it being posted again.
0
 
LVL 92

Accepted Solution

by:
objects earned 200 total points
ID: 8198419
You are doing both your update and display on the same jsp.
I would suggest splitting them into seperate page, so one page does the update and sends a redirect to the display page.
0
 
LVL 3

Expert Comment

by:wide_awake
ID: 8198424
Or just don't allow duplicate rows in your table.

They should implement something like that with E-E here to prevent people from posting the same comment over and over by reloading the page :)
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 86

Expert Comment

by:CEHJ
ID: 8198477
>>They should implement something like that

Just what i was thinking! Nobody seems to have implemented an even simpler suggestion i made:

put another 'Reload This Question' link at the *bottom* of the window.
0
 
LVL 35

Expert Comment

by:girionis
ID: 8201581
 This might help as well: http://www.javaworld.com/javaworld/javatips/jw-javatip136.html

> put another 'Reload This Question' link at the *bottom* of the window.

  This would still require the user though to refresh the page *after* (s)he has clicked on the "reload this question" link.
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 8201601
>>This would still require the user though to refresh the page *after* (s)he has clicked on the "reload this question" link.

Why? I thought clicking on that link is precisely to refresh the page. It certainly has that effect when i do it;-)
0
 
LVL 35

Expert Comment

by:girionis
ID: 8201675
 It is weird because when I post a comment I can see it clearly. However when I click on "reload this question" my comment is not there any more and I need to refresh the page again in order to see it... Maybe it has something to do with my browser (Opera 7.1).
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 8201704
Possibly ;-)
0
 

Author Comment

by:superstyled
ID: 8201770
Thanks that works a treat. Cheers.
0
 
LVL 92

Expert Comment

by:objects
ID: 8206368
Good to hear :-)
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Suggested Courses
Course of the Month10 days, 22 hours left to enroll

571 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question