[英]how to access a non getter/setter method of a java bean
I have an xhtml page that gets values from a java bean: 我有一个从Java bean获取值的xhtml页面:
<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. 问题是,当我在Tomcat 7服务器上运行此命令时,出现错误:getAccounts不是myBean属性。 The java class's getAccounts method is a standalone method that returns some results.
Java类的getAccounts方法是一个独立的方法,它返回一些结果。
Is there no way I can call this method? 我无法调用此方法吗?
Any help is appreciated. 任何帮助表示赞赏。
Thanks! 谢谢!
The property name is accounts , not getAccounts . 该属性名称是accounts而不是getAccounts 。
getAccounts
is a getter that returns the property accounts getAccounts
是返回属性帐户的getter
EL将带有get / set前缀的任何方法都视为属性,因此,如果使用任何方法调用该方法,则可以省略get / set部分。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.