Data components must be bound to one of the backing bean property types listed in Table 9–1. Data components are discussed in Using Data-Bound Table Components. Here is part of the start tag of dataTable from that section:
<h:dataTable id="items"
...
value="#{cart.items}"
var="item" >
The value expression points to the items property of a shopping cart bean named cart. The cart bean maintains a map of ShoppingCartItem beans.
The getItems method from the cart bean populates a List with ShoppingCartItem instances that are saved in the items map when the customer adds items to the cart, as shown in the following code segment:
public synchronized List getItems() {
List results = new ArrayList();
results.addAll(this.items.values());
return results;
}
All the components contained in the data component are bound to the properties of the cart bean that is bound to the entire data component. For example, here is the h:outputText tag that displays the item name in the table:
<h:commandLink action="#{showcart.details}">
<h:outputText value="#{item.item.name}"/>
</h:commandLink>