I have a problem using JSF to display some data in Facelets. I have list of hashmaps:
List<Map<String, String>> persons = new LinkedList<Map<String,String>>();
public List getPersons() {
return this.persons;
}
I get this as follows from database:
while(rs.next()) {
Map<String,String> result = new HashMap<String,String>();
result.put("name", rs.getString(1));
result.put("category", rs.getString(2));
this.persons.add(result);
}
So, my problem is how to display info for every map in xhtml. I try to used ui:repeat
but it is wrong so I need help. I must have getter for name and family but how should I add it?
<ui:repeat value="#{class.persons}" var="persons">
<h:outputText value="#{persons['name'}"/>
<h:outputText value="#{persons['family'}"/>
</ui:repeat>
I hope you understand my problem and will help me to fix it. Thanks in advance!