[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Regarding double submission of struts form issue

Posted on 2006-11-02
5
Medium Priority
?
1,113 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Working from home is a dream for many people who aren’t happy about getting up early, going to the office, and spending long hours at work. There are lots of benefits of remote work for employees.
It’s time for spooky stories and consuming way too much sugar, including the many treats we’ve whipped for you in the world of tech. Check it out!
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

649 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