The JSF-2 tag f:selectItems that iterates over a collection of POJOs offers the parameters value
and itemLabel
These generate <option>
elements of the form
<option value="value">itemLabel</option>
Now, HTML offers another attribute called label
for the <option>
tag
<option value="value" label="something_else">itemLabel</option>
but I can't see any way how to make use of that one through JSF. The background for the question is that I have my itemLabels in a localized language, but want Select2 (which replaces the <select>
here) to be able to autocomplete and match the English name, too. This I want to hide in the label
attribute.
Any ideas?