I am trying to populate a datatable from an arraylist. After searching how to do it, i found out that i need to set value attribute to an arraylist in the jsf page. Here is the related part of my managed bean:
@ManagedBean(name = "customer")
@SessionScoped
public class Customer implements Serializable {
private String identityNumber;
private String password;
private List<Account> accounts;
}
And my datatable definition in jsf page:
<h:form>
<h:dataTable id="accountsTable" value="#{customer.accounts}"></h:dataTable>
The problem is, it gives an error saying "unknown property: accounts". It can see the identityNumber and password attributes but it cannot find accounts attribute. Can anyone tell me why and help me fix it?
Thanks
Edit: I solved the error but now the table is not populated. Here is the code:
<h:form>
<h:dataTable id="accountsTable" value="#{customer.accounts}" var="account">
<h:column>
<f:facet name="header">Account Number</f:facet>
#{account.accountNumber}
</h:column>
</h:dataTable>
</h:form>
accountsright?