Yes, that's right. dataTable, ui: repeat and friends only work with lists.
You can simply add a managed bean method that puts map.keySet () or map.values () in the list, depending on which you want to iterate over.
Usually, when I want to iterate over a map from a JSF view, I do something like
<h:dataTable value="#{bean.mapKeys}" var="key"> <h:outputText value="#{bean.map[key]}"/> </h:dataTable>
with managed property bean
class Bean { public List<T> mapKeys() { return new ArrayList<T>(map.keySet()); } }
or something like that.
Of course, this makes sense if you use something like TreeMap
or LinkedHashMap
that keeps order.
source share