• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

Refreshing a page calls previous action  RSS feed

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I have a page where a user can edit his contact details. When the user clicks on the update button on that form, the update action writes the info to the database and forwards the user to a success page.

My problem is that when the user refreshes the sucess page (F5 or the refresh icon in IE), the update action class gets called again. The same thing happens when the user presses the back button the press the forward button again.

Is there a way I can code the action (or the JSP page) to clear attributes or forwards? Thank you.


regards,
Clarence
 
pie sneak
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use tokens. The key is to save a new token upon each submission. This will prevent a double submission.
 
Clarence Dyho
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Marc. It worked! And Struts has built in classes to handle it too!

Thanks so much,
Clarence
 
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Marc,

Can you please explain a little about the token on submission, i got the same problem

Thanks in Advance
Srilakshmi
 
Did you ever grow anything in the garden of your mind? - Fred Rogers. Tiny ad:
ScroogeXHTML - small and flexible RTF to HTML converter library
https://coderanch.com/t/710903/ScroogeXHTML-RTF-HTML-XHTML-converter
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!