问题
Somebody told me that JSF 2.0 automatically handles multiple submission problem. Is that right? If yes, how does JSF 2.0 do that? If no, what are the things that must taken care of, so that you don't leave any pitfall while handling this problem?
Thanks.
回答1:
This is requested and maintained by JSF spec issue 559. As it currently stands, it's not there yet, but it is targeted for the upcoming JSF 2.2.
Until then, the Seam's <s:token> is your best solution which not only prevents CSRF (which is not strictly necessary anymore since JSF 2.1 as per JSF impl issue 812), but also double submits.
回答2:
<h:commandButton onclick ="setTimeout('document.getElementById(\'' + this.id + '\').disabled=true;', 50);setTimeout('document.getElementById(\'' + this.id + '\').disabled=false;', 500);" />
Thought of improving upon your simple yet elagent solution. I think we should enable the submit button after some time. I'm sure you would have thought of this, but this is for other newbie readers like me :-)
来源:https://stackoverflow.com/questions/5889451/jsf-2-0-and-multiple-submission-problem