?
Solved

JSP SQL insert refresh button problem

Posted on 2003-03-24
10
Medium Priority
?
222 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 
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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
In this post we will learn different types of Android Layout and some basics of an Android App.
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Suggested Courses
Course of the Month12 days, 6 hours left to enroll

752 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