I am dealing with the same thing now, but selectManyListbox.
I have tried both array and list but in both cases only the last selected value is passed on.
Do you have an idea where the problem might be?
The setter already gets just one value.
JSP:
<h:selectManyListbox id="name" size="7" styleClass="listbox"
title="select one option" value="#{MyBean.selectedTaxons}">
<f:selectItems value="#{MyBean.taxons}"/>
</h:selectManyListbox>
MyBean.java:
protected List<String> selectedTaxons;
public void setSelectedTaxons(List<String> taxons) {
selectedTaxons = taxons;
}
Finally, I have found the reason. This was very difficult.
As I mentioned above, I had been getting only last selected item of the selectmanylistbox.
The problem was in the JSP page. Here is a code sample (shortened):
<h:form id="form1">
<fieldset>
<h:panelGroup>
<h:selectManyListbox id="name" size="7" styleClass="listbox"
title="select one option"
value="#{BaseWorker.querySpectrum.selectedTaxons}">
<f:selectItems value="#{search.taxons}"/>
</h:selectManyListbox>
<h:panelGroup styleClass="queryDataGroup">
<ui:upload binding="#{search.fileUpload1}" id="fileUpload1"
styleClass="fileUpload1"
uploadedFile="#{BaseWorker.querySpectrum.uploadedFile}"/>
<h:inputTextarea id="textArea1" styleClass="textArea1"
value="#{BaseWorker.querySpectrum.uploadedText}"/>
</h:panelGroup>
</h:panelGroup>
<ui:button action="#{search.searchButton_action}"
binding="#{search.searchButton}" id="searchButton"
styleClass="button searchButton" text="#{bnlGeneral.search}"/>
</fieldset>
</h:form>
I have been removing the controls one by one and the problem was in <ui:upload ... />. The whole page works well without that tag.
But why? Is it not possible to mix h: and ui:? (But the button is from ui:, too and there is no problem.)