O'Reilly logo

PrimeFaces Beginner's Guide by K. Siva Prasad Reddy

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action – creating a confirmation dialog

Let us see how to create a confirmation dialog with Yes and No options.

  1. Create a confirmation dialog using <p:confirmDialog> with two buttons for Yes and No options:
    <h:form id="form1" style="width: 300px; margin-left: 5px;"> <p:growl/> <p:panel header="User Form"> <h:panelGrid columns="2"> <h:outputText value="EmailId:" /> <p:inputText value="admin@gmail.com"/> <p:commandButton value="Delete" onclick="cnfDlg.show()" /> </h:panelGrid> </p:panel> <p:confirmDialog widgetVar="cnfDlg" header="Confirmation" message="Are you sure to delete?" > <p:commandButton value="Yes" actionListener="#{confirmDialogController.handleDelete}" oncomplete="cnfDlg.hide();" update="form1"/> <p:commandButton value="No" onclick="cnfDlg.hide();"/> ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required