如何判断在Primefaces的确认对话框中按YES或NO?

时间:2014-07-30 13:37:20

标签: jsf primefaces

方法remove被称为我单击YES或NO。 如何判断是否按下了?

    <p:commandLink  actionListener="#{mybean.remove}" 
    ajax="false"
     >
    <p:confirm header="Confirm" message="Are you sure?" icon="ui-icon-alert"></p:confirm>       <h:graphicImage value="images/erasebig.png" />
    </p:commandLink>    


    <p:confirmDialog id="dialog" global="true" showEffect="fade" hideEffect="explode" message="Are you sure?">
 <p:commandButton value="Yes" type="button" 
  styleClass="ui-confirmdialog-yes" icon="ui-icon-check" 
    />
 <p:commandButton value="No" type="button" styleClass="ui-confirmdialog-yes" icon="ui-icon-close" />
     </p:confirmDialog>

1 个答案:

答案 0 :(得分:1)

styleClass="ui-confirmdialog-no"放在无按钮上,不会调用mybean.remove()