点击后,primefaces命令按钮标签更改

时间:2017-05-08 19:21:10

标签: button primefaces label commandbutton

我有一个将数据插入数据库的命令按钮。我想点击它后更改按钮标签,然后它将被禁用。

我该怎么做?

1 个答案:

答案 0 :(得分:1)

尝试在烘焙豆中使用布尔值

在你的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>
相关问题