Jeff,
saveToken() - puts a value into the session object keyed under the constant 
TRANSACTION_TOKEN_KEY.

resetToken() - is used to remove the keyed value from the session

Any time a struts form is used the tranaction token is embedded as a hidden field in 
the form.

isTokenValid() only returns true if the token in the request matches the token in the 
session.

Hope this helps.
-Steve






"Knee, Jeff" <[EMAIL PROTECTED]> wrote:

>Matt,
>
>The example is a bit oblique to me and the Action classes JavaDoc doesn't
>elaborate very well...
>
>FWIW, I only see it used in EditRegistrationAction & SaveRegistrationAction
>with very little commenting.  Is there a different example I shoud or
>location I should be looking at?
>
>However the code comment does say:
>// Set a transactional control token to prevent double posting
>
>Which is one of the things to look at in my evaluation because this was an
>issue I've had to deal with in all of the Servlet/JSP solutions I've done...
>
>Here is my guess as to what it does:
>
>Use saveToken() to stash away a hashcode (in the sesssion) of the current
>request.
>
>Use isTokenValid() to see if the saved hashcode matches the current
>request's hashcode... if so, this is a duplicate post so then the code
>should somehow produce the same response as last time?  (I forget the math
>term... but basically have f(x) = f(f(x)).)
>
>Use resetToken() to remove the hashcode (from the session).  (If so, why
>does it have a request parameter?)
>
>Are my assumptions correct?
>
>+= Jeff Knee
>
>> -----Original Message-----
>> From: Matt Raible [mailto:[EMAIL PROTECTED]]
>> Sent: Saturday, December 01, 2001 2:01 AM
>> To: Struts Users Mailing List
>> Subject: Re: Tokens
>> 
>> 
>> see the example app - they're used to track if the form has 
>> already been
>> submitted and such (back button and reload button issues).
>> 
>> --- Stanley Struts <[EMAIL PROTECTED]> wrote:
>> > Hi, what are tokens?  Do any of you have a link of a
>> > page that discusses what are tokens and what is there
>> > use?  Thanks! :)
>> > 
>> > __________________________________________________
>> > Do You Yahoo!?
>> > Buy the perfect holiday gifts at Yahoo! Shopping.
>> > http://shopping.yahoo.com
>> > 
>> > --
>> > To unsubscribe, e-mail:   
>> <mailto:[EMAIL PROTECTED]>
>> > For additional commands, e-mail: 
>> <mailto:[EMAIL PROTECTED]>
>> > 
>> 
>> 
>> __________________________________________________
>> Do You Yahoo!?
>> Buy the perfect holiday gifts at Yahoo! Shopping.
>> http://shopping.yahoo.com
>> 
>> --
>> To unsubscribe, e-mail:   
>> <mailto:[EMAIL PROTECTED]>
>> For additional commands, e-mail: 
>> <mailto:[EMAIL PROTECTED]>
>> 
>
>--
>To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>
>
-- 




__________________________________________________________________
Your favorite stores, helpful shopping tools and great gift ideas. Experience the 
convenience of buying online with Shop@Netscape! http://shopnow.netscape.com/

Get your own FREE, personal Netscape Mail account today at http://webmail.netscape.com/


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

Reply via email to