Mohit,

An alternate way to put checks on re-submission is as follows: -

steps:
1. Generate a unique id (also called authentication id) each time you have a form to accept data
2. Put this id in a hidden field of the form and at the same time store the id in some session var
3. Whenever a form is submitted compare both the ids. If they are same all is fine. If different this is a re-submission


Thanks
Vikram.


----- Original Message ----- From: "Navjot Singh" <[EMAIL PROTECTED]>
To: "Indian Java Users Group at Delhi" <[email protected]>
Sent: Tuesday, January 04, 2005 10:56 PM
Subject: Re: [JUG-Delhi] After clicking Refresh re-entry of data



many ways to solve that.

1. After form submission, *redirect* to some other
URL. clicking refresh will just do redirect again.
cheap idea but that works ;-)
2. Use HTTP-Expires.
3. Do you have one unique field being entered in the
DB from that form. you may validate that before
inserting into DB.
4. when you display form, set 1 variable in session.
pass the same value as hidden var on html page
generated by jsp. while submission check if these 2
match and then insert. after insert, clear that value
from session.

do whatever you like ;-)

--- Passsionate <[EMAIL PROTECTED]> wrote:

Hi,

 I am using Tomcat -5.0.25 and Struts 1.1  for my
appl.
 The problem which i m encountering is that from
ControlAction.do (class overridding execute()), a
JSP is displayed. The displayed item say is of a
table with attribs Name, Age. The JSP page contains
a ADD button . On clicking  this dynamically the
text boxes appear and the user can enter the values.
On clicking Save , the values are being saved in the
database.
Now comes the problem as i refresh the page the
values gets reentered and it happens for each
refresh act.As the primary key is generated
dynamically so a check for that can't be applied.
I had tried hard to solve it, but couldn't.
 Plz. help me.
 Thanks in advance,
 Mohit Agarwal.


Yahoo! India Matrimony: Find your life
partneronline.>
_______________________________________________
Java mailing list
[email protected]

http://mail.jug-delhi.org/mailman/listinfo/java_jug-delhi.org





__________________________________
Do you Yahoo!?
Take Yahoo! Mail with you! Get it on your mobile phone.
http://mobile.yahoo.com/maildemo

_______________________________________________
Java mailing list
[email protected]
http://mail.jug-delhi.org/mailman/listinfo/java_jug-delhi.org




_______________________________________________
Java mailing list
[email protected]
http://mail.jug-delhi.org/mailman/listinfo/java_jug-delhi.org

Reply via email to