<a:form> <h:panelGrid columns="2" style="margin-bottom:10px" cellpadding="5"> <h:outputText value="Font:" /> <a:selectManyButton value="#{selectManyView.selectedOptions}"> <f:selectItem itemLabel="b" itemValue="b" /> <f:selectItem itemLabel="u" itemValue="u" /> <f:selectItem itemLabel="i" itemValue="i" /> </a:selectManyButton> <a:commandButton value="Submit" update="display" icon="ui-icon-check" /> <a:spacer /> <h:outputText value="Selected:" /> <a:dataList id="display" value="#{selectManyView.selectedOptions}" var="font" emptyMessage="No fonts selected"> <h:outputText value="#{font}" style="font-weight: bold" /> </a:dataList> </h:panelGrid> </a:form>
package com.jarch.showcase.view.input; import java.util.List; @ManagedBean public class SelectManyView { private List<String> selectedOptions; public List<String> getSelectedOptions() { return selectedOptions; } public void setSelectedOptions(List<String> selectedOptions) { this.selectedOptions = selectedOptions; } }