I have a commandbutton that inserts data into database. I want to change button label after I click it and then it will be disabled.
How can I do it?
Try with a boolean value in your baking bean
in your bean
boolean buttonDisabled = false;
.xhtml
<p:commandButton "#{yourBean.buttonDisabled ? 'old label' : 'new label'}" disabled="#{yourBean.buttonDisabled}">
<f:setPropertyActionListener value="true"
target="#{yourBean.buttonDisabled}" />
</p:commandButton>