myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andreas Zeller - zit-systems <andreas.zel...@zit-systems.de>
Subject Re: how do I prevent nervous users starting actions more than once???
Date Sun, 26 Mar 2006 02:35:03 GMT
Hey Emily,

If your Button causes your application to fail in some way, you could
catch that kind of bad user interaction by identifying the clicked
button via the component id (which is unique for each component on your
page).
This is kind of a "dirty" solution, but if the application switches to a
different state, the triggered action should be "locked", so it can't be
accessed again, unless it won't cause any damage.

You would do this by giving the commandButton an ID, setting an f:param
inside the button and getting this parameter (if you have a dynamic
model and need to know which button has been clicked) back in the
application via an ActionEvent, which is a parameter for an
actionListener method.

I had to do this for a system that locks datasets and prevents other
users from editing. A user should only be able to edit one record at a
time. If the user acts quickly and clicks several buttons on the page,
that would open many open records. So what I did, is catch the ID and
the param, unlock the records he clicked before and open only the last
one for editing. If your problem is similar in some way, this might be a
solution. A dirty one, I admit, but it works.

Andreas

Emily Gu wrote:

> Hi,
>  
>  Would you please let me know how do you know it is clicked the same
> button so that you can provent the next click by doing this?
>  
> Thanks,
> Emily
>
>  
> On 1/25/06, *Hansjörg Meuschel* <hjmeu@gmx.de <mailto:hjmeu@gmx.de>>
> wrote:
>
>     Hi Steffen,
>     thanks for this great information, the filter works perfectly and
>     solved
>     one of my biggest problems with my application !!!!!
>
>     Steffen Hankiewicz wrote:
>
>     >Hi Hansjörg,
>     >
>     >
>     >
>     >>how can I prevent impatient users of my webapp to perform
>     actions twice
>     >>by clicking serveral times on the commandbuttons ??
>     >>
>     >>
>     >
>     >I  am using a servlet filter which works great here. Maybe you
>     want to
>     >give it a try:
>     >
>     >
>     http://www.onjava.com/pub/a/onjava/2004/03/24/loadcontrol.html?page=1
>     >
>     >HTH,
>     >
>     >Steffen Hankiewicz
>     >
>     >
>     >
>     >
>
>


Mime
View raw message