更新时间:2021-10-23 01:53:34
如果属性名称以两个或多个大写字符开头,则将假定为这种情况.吸气剂getFStations()
表示属性名称为FStations
,因此您应该这样访问它:
If a property name starts with two or more uppercased characters, then it will be assumed to be in exactly that case. The getter getFStations()
indicates a property name of FStations
, so you should then access it as such:
<h:dataTable value="#{vManager.FStations}" var="row">
8.8推断名称的大写.
...
8.8 Capitalization of inferred names.
...
因此,当我们从现有Java名称的中间提取属性或事件名称时, 通常将第一个字符转换为小写.但是,为了支持偶尔使用所有大写的名称,我们检查名称的前两个字符是否均为大写,是否保留为大写.例如,
Thus when we extract a property or event name from the middle of an existing Java name, we normally convert the first character to lower case. However to support the occasional use of all upper-case names, we check if the first two characters of the name are both upper case and if so leave it alone. So for example,
我们提供了一种方法 Introspector.decapitalize
来实现此转换规则.
We provide a method Introspector.decapitalize
which implements this conversion rule.
请注意,属性名称是根据getter方法名称而不是私有字段名称来定义/解析的.
Note that the property name is definied/resolved based on getter method name, not on private field name.
无关与具体问题无关,但是我强烈建议不要缩写这样的属性名称.您的代码是这种方式,不能自我记录.别偷懒,写出完整的单词:
Unrelated to the concrete problem, I however strongly recommend to not abbreviate property names like that. Your code is this way not self-documenting. Don't be lazy and write words full out:
<h:dataTable value="#{visitorManager.fireStations}" var="fireStation">
或者也许:
<h:dataTable value="#{visitor.fireStations}" var="fireStation">