Hi Andreas,
 
Thanks for your reply. Pretty much similar. Only mine is simpler. I have several <h:commandLink> buttons on the same page. I would like only allow the first button click taking effect and disable all others. And only allow one click for a button. Otherwise it has submitted the same form data many times. If you have sample code, would you please send it to me? I would like to see how you get the component id and identify it is from the same page and but a duplicated request.
 
Thanks a lot!!
Emily

 
On 3/25/06, Andreas Zeller - zit-systems <[EMAIL PROTECTED]> wrote:
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 <[EMAIL PROTECTED]> 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
>
>
>
>




Reply via email to