Re: Refreshing Issue.
Hi Anurag, Sounds like that when you reset the parameters are being resent, so the action 'add' action is being called again. Struts has a way of dealing with this situation with a token stored in the submit form, here is a link to an earlier thread: http://www.mail-archive.com/[EMAIL PROTECTED]/msg68432.html Apparently there is an example of its use in struts-example.war -- Jason Lea Anurag Garg wrote: Hi All, I am facing a problem in jsp page refreshing. After submitting the page to add a new record in the database, I again display the same page with the added record in the list. Now If I press F5 (I am not clicking the ADD button) it again adds a new record(duplicate record) in the database, which it should not do. I have added the following line in my Action Class response.setHeader("pragma","no-cache"); I have also added the following statement in the struts-config.xml But still it is adding the duplicate record in the database when i press F5. Any solution how to overcome this problem.. Thanks and Regards, Anurag Garg - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Refreshing Issue.
Hi, This is a common problem and have a look at the 'Synchronizer Token' J2EE pattern for more details. Below I am pasting the URL where the problem is elucidiated. http://www.javaworld.com/javatips/jw-javatip136_p.html HTH, Ravi Kora > -Original Message- > From: Ravi Garg [mailto:[EMAIL PROTECTED] > Sent: Friday, July 11, 2003 6:26 AM > To: Struts Users Mailing List; [EMAIL PROTECTED] > Subject: RE: Refreshing Issue. > > > Dear Anurag, > This is a general problem. Actually when you refresh > your page then the previous action which has called this > page(which is in this case this page it self) is again > submitted. And this previous page is taken from the history > of your computer. To prevent this you can do one thing the > clear history on submit of this page or else disable the > refresh option. > > > Cheers > Ravi > > -Original Message- > From: Anurag Garg [mailto:[EMAIL PROTECTED] > Sent: Friday, July 11, 2003 3:38 PM > To: Struts Users Mailing List (E-mail) > Subject: Refreshing Issue. > > Hi All, > > I am facing a problem in jsp page refreshing. After > submitting the page to add a new record in the database, I > again display the same page with the added record in the > list. Now If I press F5 (I am not clicking the ADD > button) it again adds a new record(duplicate record) in the > database, which it should not do. > > I have added the following line in my Action Class > response.setHeader("pragma","no-cache"); > > I have also added the following statement in the struts-config.xml > > > But still it is adding the duplicate record in the database > when i press F5. Any solution how to overcome this problem.. > > Thanks and Regards, > Anurag Garg > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Refreshing Issue.
opps.. you may loss what it is your displaying if your putting it in the request.. in which case ..this is the action that lists all your records... //your forward then recalls the original action // in your action return (mapping.findForward("good"); would be one way of doing what you want On Friday, July 11, 2003, at 11:27 AM, Mark Lowe wrote: redirect="true" where you define your forward. //in your action return (mapping.findForward("good")); //Struts-config HTH mark On Friday, July 11, 2003, at 11:07 AM, Anurag Garg wrote: Hi All, I am facing a problem in jsp page refreshing. After submitting the page to add a new record in the database, I again display the same page with the added record in the list. Now If I press F5 (I am not clicking the ADD button) it again adds a new record(duplicate record) in the database, which it should not do. I have added the following line in my Action Class response.setHeader("pragma","no-cache"); I have also added the following statement in the struts-config.xml But still it is adding the duplicate record in the database when i press F5. Any solution how to overcome this problem.. Thanks and Regards, Anurag Garg - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Refreshing Issue.
Dear Anurag, This is a general problem. Actually when you refresh your page then the previous action which has called this page(which is in this case this page it self) is again submitted. And this previous page is taken from the history of your computer. To prevent this you can do one thing the clear history on submit of this page or else disable the refresh option. Cheers Ravi -Original Message- From: Anurag Garg [mailto:[EMAIL PROTECTED] Sent: Friday, July 11, 2003 3:38 PM To: Struts Users Mailing List (E-mail) Subject: Refreshing Issue. Hi All, I am facing a problem in jsp page refreshing. After submitting the page to add a new record in the database, I again display the same page with the added record in the list. Now If I press F5 (I am not clicking the ADD button) it again adds a new record(duplicate record) in the database, which it should not do. I have added the following line in my Action Class response.setHeader("pragma","no-cache"); I have also added the following statement in the struts-config.xml But still it is adding the duplicate record in the database when i press F5. Any solution how to overcome this problem.. Thanks and Regards, Anurag Garg - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Refreshing Issue.
redirect="true" where you define your forward. //in your action return (mapping.findForward("good")); //Struts-config HTH mark On Friday, July 11, 2003, at 11:07 AM, Anurag Garg wrote: Hi All, I am facing a problem in jsp page refreshing. After submitting the page to add a new record in the database, I again display the same page with the added record in the list. Now If I press F5 (I am not clicking the ADD button) it again adds a new record(duplicate record) in the database, which it should not do. I have added the following line in my Action Class response.setHeader("pragma","no-cache"); I have also added the following statement in the struts-config.xml But still it is adding the duplicate record in the database when i press F5. Any solution how to overcome this problem.. Thanks and Regards, Anurag Garg - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]