I have following two simple POJOs:
class Person {
String name
Address address;
//and of course the getter/setter for the attributes
}
class Address {
String city;
//also getter/setter for this attribute
}
And a backing bean:
@ManagedBean
@RequestScoped
class PersonController {
private List persons;
private List<String> columns = Arrays.toList("name", "address.city");
//of course getter/setter
}
Now I want to create a dataTable.
<p:dataTable var="person" value="#{personController.persons}" columnIndexVar="index">
<p:columns var="column" value="#{personController.columns}">
<h:outputText value="#{person[column]}"/>
<p:columms>
</p:dataTable>
When I execute this I get a ServletException:
The class Person does not have the property 'address.city'.
But if a try to access the property city like this within p:columns:
<h:outputText value="#{person.address.city}"/>
Everything is fine.
Why I can not access a nested property like that #{person['address.city']}
? And how can I access it within p:columns
?
<h:columns>
tag does not exist. Aren't you overgeneralizing the PrimeFaces<p:columns>
tag? – Maiga