Am Freitag, 21. November 2003 16:46 schrieb Richard J. Duncan: > Is there a complete end-to-end example of proper saveToken() > isTokenValid() usage anywhere? (there should be)
Check out the Struts Example application that comes with Struts. Then, tokens are explained best in Struts in Action (one paragraph, IIRC). No, three, and on p. 295. So the index is wrong which says p. 287. Anyway. When you're about to start a transaction, say saveToken(request) somewhere in your Action. From then on, Struts forms will automatically be aware of the Token and deliver it along with each request. When using <html:link>, set the transaction attribute to 'true' to have them behave likewise. When it finally comes to applying permanent changes to the Model (backend, database, EIS, whatever) which you want to happen only once, check for the token before entering the code in question by calling isTokenValid(request). If it's there, proceed, if not, branch to some error page or just ignore the (second) attempt . If the token is valid, execute he backend code and call resetToken(request) to enable possible subsequent transactions. If the user has pressed the 'Send' button twice in-between, the second request will fail because of the isTokenValid(request) check, and once you say resetToken(request), the token won't be valid anymore. Until you generate a new transaction via saveToken(), but that a different one, then. > Regards, > � > Rich HTH, -- Chris. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

