On Wed, 06 Feb 2008, Matthijs Wensveen wrote:
> I have a Link (not Ajax) on a component that does some heavyweight
> processing in onClick. During this processing I want to block other
> clicks from the same user. Is there a generic way to block multiple
> requests on the same link? I would prefer a solution without Ajax /
> JavaScript, but if that's impossible then that's okay.
Components are stateful, so maybe you could just keep the
state in your Link?
@Override onClick() {
if (!isEnabled()) {
return; // this shouldnt happen though?
}
try {
setEnabled(false);
doSomeHeavyWeightProcessing();
} finally {
setEnabled(true);
}
}
This creates a little race condition but if you can produce
it you could try using a real lock mechanism.
Best wishes,
Timo
--
Timo Rantalaiho
Reaktor Innovations Oy <URL: http://www.ri.fi/ >
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]