SelectOneListbox SelectOneListbox is used to choose a single item from a list.
  • Option 1
  • Option 2
  • Option 3
Afterdark
Afternoon
Afterwork
Aristo
Black-Tie
Blitzer
Bluesky
Bootstrap
Casablanca
Cupertino
Cruze
Dark-Hive
Delta
Dot-Luv
Eggplant
Excite-Bike
Flick
Glass-X
Home
Hot-Sneaks
Humanity
Le-Frog
Midnight
Mint-Choc
Omega
Overcast
Pepper-Grinder
Redmond
Rocket
Sam
Smoothness
South-Street
Start
Sunny
Swanky-Purse
Trontastic
UI-Darkness
UI-Lightness
Vader

Selected Values
Basic:
Advanced:
<h:form>
    <h:panelGrid columns="2" style="margin-bottom:10px" cellpadding="5" columnClasses="label, value">
        <p:outputLabel for="basic" value="Basic:" />
        <p:selectOneListbox id="basic" value="#{selectOneView.option}">
            <f:selectItem itemLabel="Option 1" itemValue="1" />
            <f:selectItem itemLabel="Option 2" itemValue="2" />
            <f:selectItem itemLabel="Option 3" itemValue="3" />
        </p:selectOneListbox>

        <p:outputLabel for="advanced" value="Advanced:" />
        <p:selectOneListbox id="advanced" value="#{selectOneView.theme}" converter="themeConverter" var="t" filter="true" filterMatchMode="contains">
            <f:selectItems value="#{selectOneView.themes}" var="theme" itemLabel="#{theme.displayName}" itemValue="#{theme}" />

            <p:column>
                <h:outputText styleClass="ui-theme ui-theme-#{t.name}" />
            </p:column>

            <p:column>
                <h:outputText value="#{t.displayName}" />
            </p:column>
        </p:selectOneListbox>
    </h:panelGrid>

    <p:separator />

    <p:commandButton value="Submit" update="display" oncomplete="PF('dlg').show()" icon="ui-icon-check" />

    <p:dialog header="Selected Values" modal="true" showEffect="fade" widgetVar="dlg" resizable="false">
        <p:panelGrid columns="2" id="display" columnClasses="label,output">
            <h:outputText value="Basic:" />
            <h:outputText value="#{selectOneView.option}" />

            <h:outputText value="Advanced:" />
            <h:outputText value="#{selectOneView.theme}" />
        </p:panelGrid>
    </p:dialog>
</h:form>
                
PrimeTek, Copyright © 2015
All rights reserved.
Running PrimeFaces-6.0.12 on Mojarra-2.2.8.