Reputation: 21
I have an xhtml page that gets values from a java bean:
<h:dataTable value="${myBean.getAccounts}" var="account">
<h:column>
<f:facet name="header">Account ID</f:facet>
#{account.id}
</h:column>
<h:column>
<f:facet name="header">Account Name</f:facet>
#{account.name}
</h:column>
</h:dataTable>
The problem is that when I run this on a Tomcat 7 server, I get an error: getAccounts is not a myBean property. The java class's getAccounts method is a standalone method that returns some results.
Is there no way I can call this method?
Any help is appreciated.
Thanks!
Upvotes: 2
Views: 963
Reputation: 137
EL treats any method with get/set prefix as a property, so if you call your method anything with that you can just omit the get/set part.
Upvotes: 1
Reputation: 1239
Jeff's answer is correct. Just some additional info:
Your method is called getAccounts() but in EL you need to say #{mybean.accounts}
There is a good complete example of using a h:dataTable here
Upvotes: 1
Reputation: 57202
The property name is accounts, not getAccounts. getAccounts
is a getter that returns the property accounts
Upvotes: 5