The Struts saveToken() & isTokenValid() methods save a token so that double submits are detected and can be dealt with. Just disabling the submit button won't stop a user submitting and then refreshing the page (which submits the same info twice) or going back in their history and clicking submit on an earlier page.


Geeta Ramani wrote:


Gurpreet:

Don't mean to jump in if you already have found a good solution, but wouldn't it be simpler to just not allow the user to press the submit btton twice? It is easy (using Javascript) to disable a submit button once it has already been pressed..

Regards,
Geeta

"Mainguy, Mike" wrote:



Call saveToken() in GET (or read)
Test isTokenValid() in the POST (or write) to see if it is a dupe (duplicate
returns false [bad token])

worse is better

-----Original Message-----
From: Gurpreet Dhanoa [mailto:[EMAIL PROTECTED]
Sent: Wednesday, November 19, 2003 11:19 PM
To: Struts Users Mailing List
Subject: Re: Tokens

hi Ramadoss

Thanks for your help. But this is not i m looking for.
I may not be able to explain my question proeprly .
But i m looking for saveTOken() method implementation in struts which does
not allow duplicate entry of records into the database when the user click
on submit button twice.

----- Original Message -----
From: "Ramadoss Chinnakuzhandai" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Wednesday, November 19, 2003 7:56 PM
Subject: RE: Tokens



Hi Gurpreet,
If what I understand is correct from your question, you can
use


split function the same way as you use String Token...following is sample
snap shot


String str = "botherouioero:and:foroffo:mar:ssod:slave";
String[] arr = str.split(":", 9);
System.out.println("length of arr[] is:" + arr.length);
for (int i = 0; i < arr.length; i++) {
System.out.println("value is :" + arr[i]);
}
String[] ar = str.split("o", 8);
System.out.println("length of arr[] is:" + ar.length);
for (int i = 0; i < ar.length; i++) {
System.out.println("value is :" + ar[i]);
}
Where the number 9 and 8 denotes number of occurences you want to
consider


after which it will be treated as whole single string and will be included
into your String Array.


Hope this help,

-Ram




-----Original Message----- From: Gurpreet Dhanoa [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 19, 2003 6:19 AM To: Struts Users Mailing List; [EMAIL PROTECTED] Subject: Tokens


hi All


Can somebody explain small code snap shot of using Tokens. AS i am
trying to use it in one of my application. but due to some unknown
reason it is


not


working. I may be doing something wrong.


Any help will be appreciated



Regards GAry






--
Jason Lea




--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to