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 – the Dialog component close event listener

Let us see how we can register a listener for the close event using the following steps:

  1. Create a Dialog component and register a close event listener using the <p:ajax> tag:
    <h:form id="form3" style="width: 400px;"> <p:messages id="msgs" for="SampleDialog"/> <p:panel header="Dialog - Close Event Listener"> <p:commandButton value="ShowDialog" onclick="dlg3.show();" type="button" /> <p:dialog id="SampleDialog" header="Sample Dialog" widgetVar="dlg3" width="300" height="50" showEffect="bounce" hideEffect="explode" closeOnEscape="true"> <p:ajax event="close" update="msgs" listener="#{dialogController.handleDialogClose}"/> <p:outputLabel value="PrimeFaces Dialog"/> </p:dialog> </p:panel> </h:form> ...

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