<f:selectItems> already supports cards.
<f:selectItems value="#{bean.listGroups}" />
The card key becomes the option label, and the card value becomes the parameter value.
However, you probably want to use LinkedHashMapinstead HashMapif it is important to display the map entries in the input order or TreeMapif you want to automatically sort them by card key.
see also
source
share