Sometimes you need to display different outputs or components depending on a value. Usually you can achieve this by using the ui:fragment tag. With the pe:switch util tag you won't have to declare ui:fragment tags, with different checks like ui:fragment rendered="#{!empty someController.value}", anymore.

Case: Default
<p:growl id="growl" showDetail="true" />

<p:selectOneMenu id="caseSelection" value="#{switchController.value}">
	<f:selectItem itemLabel="Default case" itemValue="default" />
	<f:selectItem itemLabel="Case 1" itemValue="case1" />
    <f:selectItem itemLabel="null" itemValue="#{null}" />
    <f:selectItem itemLabel="Case 2" itemValue="case2" />

    <p:ajax update="swichWrapper" process="@this" />

<p:separator />

<p:outputPanel id="swichWrapper">
    <pe:switch id="switch" value="#{switchController.value}">
                    Case: Default

            <pe:case value="case1">
                    Case: <p:commandButton id="case1button" actionListener="#{switchController.listener('case1')}" update=":mainForm:growl"
                                    value="Call listener with 'case1'" />

            <pe:case value="case2">
                    Case: <p:commandButton id="case2button" actionListener="#{switchController.listener('case2')}" update=":mainForm:growl"
                                    value="Call listener with 'case2'"  />

            <pe:case value="#{null}">
                    Case: Null
Components and more
Documentation pe:switch
Attributes (move mouse over the names to see data types)
Name Description
id Unique identifier of the component in a namingContainer.
rendered Boolean value to specify the rendering of the component, when set to false component will not be rendered.
binding An EL expression referring to a server side UIComponent instance in a backing bean.
value Value of the component.
PrimeFaces Extensions Showcase - © 2011-2019, PrimeFaces: 7.0, PrimeFaces Extensions: 7.0, JSF: mojarra 2.3.2, Server: jetty/9.4.2.v20170220, Build time: 2019-03-18 20:52