?
Solved

Regarding double submission of struts form issue

Posted on 2006-11-02
5
Medium Priority
?
1,112 Views
Last Modified: 2012-06-21
Hi Experts,
I have a struts form which I have to stop double submission thru saveToken..
but I am not able to understand the functionality of saveToken and isTokenvalid function of struts...

Pls help

Regards,
dojjol


0
Comment
Question by:dojjol
[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
  • 2
  • 2
5 Comments
 
LVL 10

Assisted Solution

by:jaggernat
jaggernat earned 800 total points
ID: 17858221
0
 
LVL 14

Accepted Solution

by:
boonleng earned 1200 total points
ID: 17863496
When saveToken() method is invoked, struts will generate a unique key/token and store it into httpsession. The unique key will also be stored as a hidden field (form submition) or as a parameter in url link.

Once the form submitted, the method isTokenValid() will verify the submitted unique key (the hidden field) with the unique key value stored in httpsession. If both value match means 1st time submittion, so will call removeToken() to remove the unique key from httpsession.

If the user refesh page or resubmit the form using back button, the isTokenValid() will trigger again, coz the unique key has been removed from httpsession, the verification fail. This mean the form is resubmitted.

Hope this able to help you understand.

Regards,
Boon Leng
0
 

Author Comment

by:dojjol
ID: 17865120
Hi,

It will be really helpful for me if I can have any sample Action class processing theses functions..

Thanks in advance,
Dojjol

0
 
LVL 10

Expert Comment

by:jaggernat
ID: 17867071
the link i posted above has 4 pages. did you go through the second page? It has all the code.
Second page :
http://www.javaworld.com/javaworld/javatips/jw-javatip136.html?page=2
0

Featured Post

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

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

New style of hardware planning for Microsoft Exchange server.
The top devops trends for 2017 are focused on improved deployment frequency, decreased lead time for change and decreased MTTR.
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses
Course of the Month8 days, 15 hours left to enroll

765 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