I have a jsf
<p:commandButton>
in my xhtml
page.I need to call a function in the bean class with this button click and I need to disable the button so that if user click it again the bean class method should not call again and again.I tried many examples. The button is appeared to be disabled but if I click it again and again the bean class method is called again and again.How can I avoid this.This is the code currently I have.
<p:commandButton ajax="false" action="#{targetAchievementBean.calculate()}" value="Calculate" onclick="jQuery(this).addClass('ui-state-disabled')"/>
Please be specific with the question because I have tried many examples.Help me on this.