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 – using Panel with event listeners

Let us see how we can create a panel with close and toggle options and register AJAX event listeners for close and toggle events.

  1. Create a Panel component and register event listeners for close and toggle events:
    <p:panel id="AboutPrimeFacesPanel" closable="true" toggleable="true">
      <p:ajax event="close" listener="#{sampleController.handleClose}" />  
      <p:ajax event="toggle" listener="#{sampleController.handleToggle}"/> 
      <f:facet name="header">
        About PrimeFaces
      </f:facet>
      <f:facet name="footer">
        PrimeFaces Rocks!!!
      </f:facet>
      <p:outputLabel value="PrimeFaces is an open source JSF component suite with 100+ Components."/>
    </p:panel>
  2. Implement event listener methods:
    public class SampleController { public ...

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