JSF 2.0 and Multiple Submission problem

隐身守侯 提交于 2019-12-09 07:03:34

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!