myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Craig McClanahan <craig...@gmail.com>
Subject Re: how do I prevent nervous users starting actions more than once???
Date Tue, 24 Jan 2006 20:40:32 GMT
On 1/24/06, Simon Kitching <skitching@apache.org> wrote:
> Well, the only way to prevent the form being *submitted* multiple times
> is with a client-side solution. It would be nice for this to be
> integrated into the command components - I'll raise a JIRA enhancement
> for this.
>
> On the server side, there are a couple of issues.
>
> The first is that the view is not thread-safe, so having multiple
> submits for the same user/view running concurrently is bad news. This
> can be fixed by having a filter that does
>   synchronized(userSession) { call jsf stuff }
> Again it would be nice if MyFaces did this automatically.
>

Note that, if you use client side state saving, the issue is somewhat
different ... the view trees will be distinct (because they are each
restored from their own request), and they'll each get their own
copies of request scope backing beans too.  Any potential collision
would occur on either session/application scope beans, or on other
resources accessed from the request scope backing beans.

> The second is that even when synchronizing the view, the first submit
> will change all sorts of state, so that the second one will cause
> interesting effects. This can be (partly) handled via a "token" or
> counter that is embedded in the page and is verified against a counter
> in the user session; if they get out-of-sync then the user is using the
> back button in the browser or sending multiple submits. As another email
> indicated, structs/shale has some support for this.
>

One could argue that an implementation of server side state saving
should never vend the same view tree more than once, but that would
have interesting implications on what to do with back buttons.

> Regards,
>
> Simon
>

Craig

Mime
View raw message