I hope somebody could help me with this issue, it's the first time I'm working with JSF after working for three years with Struts2. I need a functionality in JSF to handle double submit on an xhtml page. I mean I have a h:commandButton hich executes an action which registers a group of entities in a database and send an email after this, all this is done, but since it takes some time to perform the operation, the user can click again the submit button, that's why I need to avoid the second click, is there any idea for this?
I'll be grateful if somebody could help me with this please, thanks in advance.
On the server side, I would generally attach some sort of unique identifying token to the data. A transaction ID is always useful, if available. I then interlock at the database transaction level. So a double-submit can happen, but the second attempt to update the database would bounce.
Which leads us to the final part of the triad. If they DO manage to double-submit and they DO bounce, you ideally want to not display the bounce as a error to the client as long as the original transaction was a success.
An IDE is no substitute for an Intelligent Developer.