On Tue, 14 Aug 2001, Tim Fox wrote:
> Anyone know of any examples of how to use the
> saveToken(), resetToken(), and isTokenValid() methods - for prevention of
> submission of forms multiple times.
> I can't find anything in the docs.
> Specifically I want to be able to use them in the situation where I *don't*
> have a <html:form> in my page - is this possible?
> thanx in advance
>
If you don't have a form, then what you are trying to prevent is following
the same hyperlink twice, right? In that case, you can tell the
<html:link> tag to include the transaction control token like this:
<html:link href="/foo.do" transaction="true"/>
This will cause the token to be included on the hyperlink as a query
parameter, so that you can check it with isTokenValid() in your action
associated with path "/foo", just as if it came in on a form. Once you've
validated that, the action can forward to whatever page you actually want
to display.
Craig