我在屏幕上有两个按钮。首次加载页面时,我想禁用按钮 2,直到单击按钮 1。单击 button1 时,必须启用 button2。
我试过了:
<p:commandButton value="Normalize"
actionListener="#{mainTable.normalize}" update="dataTable"
id="normalize" styleClass="ui-priority-primary"
style="font-size: 14px">
<f:setPropertyActionListener value="#{true}"
target="#{mainTable.disable}" />
</p:commandButton>
<p:commandButton value="To Verify Next->" action="verify.xhtml"
actionListener="#{mainTable.verify}" id="next"
styleClass="ui-priority-primary" style="font-size: 14px"
disabled="#{!(bean.disable)}">
</p:commandButton>
我的豆子:
@ManagedBean
@SessionScoped
public class MainTable
{
private boolean disable;
public MainTable()
{
disable = false;
}
public boolean isDisable()
{
return disable;
}
public void setDisable(boolean disable)
{
this.disable = disable;
}
}
但它不起作用。当我单击按钮 1 时,按钮 2 仍然被禁用。怎么了?