Inge,
I have been looking at this issue also, but haven't made any progress.  

My plan was to generate a random value for each page so that Tapestry would 
catch it during the rewind and then abort the rest of the comparing that goes 
on.  I was going to create a component that was embedded in my "Border 
component/Frame Component".  That way as each page is rendered I could have a 
unique value.  One of my issues is what do I do with DirectLinks?

I would really appreciate if you posted your results back to the list.

regards,

Mark


-----Original Message-----
From: Inge Solvoll [mailto:[EMAIL PROTECTED]
Sent: Thu 3/2/2006 8:33 AM
To: Tapestry users
Subject: Re: "Token" approach to avoiding double submits
 
I'll try that, thanks Geoff!

I'll try to get into this, anyone else who has done something similar and
has some code to share? If not, I will send excerpts of my code when I'm
done.

Inge

On 3/2/06, Geoff Longman <[EMAIL PROTECTED]> wrote:
>
> You could craft your own Form component that handles the hidden and
> use the tapestry-flash thingy to save the token
>
> Geoff
>
> On 3/2/06, Inge Solvoll <[EMAIL PROTECTED]> wrote:
> > I've tried to copy the token-approach from struts into Tapestry, to
> avoid
> > crashes when the user hits the "refresh"-button in the browser. Using
> this
> > approach, the html rendered can only be submitted once. My problem is
> that
> > the code I've written so far requires too much code copying and
> repeating,
> > and I was wondering if someone has ideas on how to make the
> implementation a
> > bit less intrusive for my pages.
> >
> > I could include this code in my base class that all my page classes
> inherit
> > from, but then I would have to inject WebRequest into every single page
> in
> > my application, and that's not the tapestry way to do page design, is
> it?
> > I'm pretty sure that this is functionality that I need in all my pages
> > (refresh of a post causes crash most of the times in my tapestry code).
> > Maybe this can be done with a servlet filter, or better, with a HiveMind
> > service that intercepts the request?
> >
> > Here's my code so far:
> >
> > public void pageBeginRender(PageEvent event) {
> >     if (getRequestCycle().isRewinding()) {
> >       String token = getRequest().getParameter("token");
> >       if (token == null || !token.equals(getToken())) {
> >         log.error("Token for page is not valid, redirect to obtain last
> good
> > state");
> >         throw new PageRedirectException(this);
> >       }
> >     }
> >     else {
> >       setToken(generateToken());
> >     }
> >
> > }
> >
> > .html:
> > <input jwcid="@Any" type="hidden" name="token" value="ognl:token"/>
> >
> > .page:
> > <property name="token" persist="session"/>
> >
> >
> > An article on the subject:
> > http://www.javalobby.org/java/forums/m91956568.html
> >
> >
>
>
> --
> The Spindle guy.          http://spindle.sf.net
> Get help with Spindle:
> http://lists.sourceforge.net/mailman/listinfo/spindle-user
> Blog:                     http://jroller.com/page/glongman
> Feature Updates:          http://spindle.sf.net/updates
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to