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 the SelectManyButton component

Let us see how to use the <p:selectManyButton> component, by performing the following step:

  1. Create a form with the <p:selectManyButton> component with multiple options:
    <h:form>
        <p:panel header="SelectManyButton">
        <h:panelGrid style="margin-bottom:5px" cellpadding="3">
            <p:selectManyButton value="#{selectionController.numbers}">
                <f:selectItem itemLabel="One" itemValue="1"/>
                <f:selectItem itemLabel="Two" itemValue="2"/>
                <f:selectItem itemLabel="Three" itemValue="3"/>
        </p:selectManyButton>
        </h:panelGrid>  
        
        <p:commandButton value="Submit" update="display"/>
        <h:outputText id="display"value="  Value : #{selectionController.numbers}" /> 
        </p:panel>
    </h:form>

What just happened?

We have used the <p:selectManyButton> ...

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