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 SelectOneListbox with POJOs

Let's look at creating a SelectOneListbox backed by a collection of POJOs using a converter, by performing the following step:

  1. Create a form with the SelectOneListbox component using POJOs:
    <h:form> <p:panel header="SelectOneListbox"> <h:panelGrid columns="2" style="margin-bottom:5px" cellpadding="3"> <h:outputText value="Listbox Using POJO: " /> <p:selectOneListbox value="#{selectionController.selectedTag}" var="t" converter="#{tagConverter}"> <f:selectItems value="#{selectionController.tagPojos}" var="tag" itemLabel="#{tag.label}" itemValue="#{tag}"/> <p:column> #{t.label} - #{t.value} </p:column> </p:selectOneListbox> </h:panelGrid> <p:commandButton value="Submit" update="display" /> <h:outputText ...

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