This week's book giveaway is in the Java in General forum.
We're giving away four copies of Helidon Revealed: A Practical Guide to Oracle’s Microservices Framework and have Michael Redlich on-line!
See this thread for details.
  • 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Double click and Back Button Question (Tokens!!)

 
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello All,
I have used the saveToken(), isTokenValid(), and resetToken() in my application to prevent double click posts and back button posts. Everything seems to work as intended. This is good, but I have one issue.

I am using an if statement now with the isTokenValid() method.

If it's valid, I run the code that posts my data, if not...

here's my issue. If NOT, I want it to still tell the user that the data has been submitted, and I want to show the user a receipt. This can be done without messing with the database by creating all the variables I need and sending them to the form before I call isTokenValid(). This works for a double click. But if someone hits BACK and changes information in the fields and then hits submit, this will give them a receipt that is false, because that data wasn't submitted.

Any ideas on how to combat this? Or any ideas that you guys have used when using isTokenValid()? Do you just send them to an error page?

Thanks for any help!!!

P.S. Sorry if this is confusing! I can try to be more clear with specific questions!

-Nate
 
author & internet detective
Posts: 42055
926
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Nate,
I recommend storing the submitted data in the session. Then you can verify it really was submitted before supplying a receipt.
 
Nate Leech
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Jeanne,
That Solved my problem! Thank you very much!!!

-Nate
 
If you have a bad day in October, have a slice of banana cream pie. And this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic