I get call in a flow a method which returns a HashSet
of Person
back. Then i call the Set
in my xhtml file with the Primeface-dataTable
. Now i want to display the prename of the person, but a error appear and say, he doesn't found "prename"...
Then i put the HashSet in a ArrayList
and do the same. And... it works fine! But why?
Set and List use as Superinterfaces Collection
& Iterable
. So why this don't work with Set?
Here are the parts of the files:
flow.xml
<view-state id="rcpm" view="rc/rcmembers.xhtml">
<on-entry>
<evaluate expression="RCHtmlCache.getCommunityList('rcpm')"
result="flowScope.members" />
</on-entry>
</view-state>
rcmembers.xhtml
<p:dataTable id="table1" var="member" value="#{members}"
sortMode="multiple" rowIndexVar="status"
emptyMessage="The Community is empty.">
<p:column>
<f:facet name="header">
<h:outputText value="Vorname" />
</f:facet>
<h:outputText value="#{member.vorname}" />
</p:column>
RCHtmlCache.java Set Version
public Set<Person> getCommunity(String key) {
return htmlCache.get(key);
}
RCHtmlCache.java List Version
public List<Person> getCommunityList(String key) {
Set<Person> comList = htmlCache.get(key);
ArrayList<Person> result = new ArrayList<Person>();
for (Person person : comList) {
result.add(person);
}
return result;
}
Hope you can explain me this weird incident...