以"is"开头的布尔属性不起作用 [英] boolean properties starting with "is" does not work
问题描述
我有一个使用JSF 2.1和PrimeFaces的项目.我尝试使用引用#{myBean.matriz}
的简单<h:outputText>
并收到此错误:
I have a project that use JSF 2.1 and PrimeFaces. I tried to use a simple <h:outputText>
referencing #{myBean.matriz}
and I got this error:
SEVERE: javax.el.PropertyNotFoundException: ... value="#{myBean.matriz}": Missing Resource in EL implementation: ???propertyNotReadable???
吸气剂是:isMatriz()
.应该是getMatriz()
吗?
The getter is: isMatriz()
. Should it be getMatriz()
?
推荐答案
is
前缀仅适用于boolean
,不适用于Boolean
.
The is
prefix works only for boolean
, not Boolean
.
您显然在那里实际上一个Boolean
属性.
You've there apparently actually a Boolean
property.
您有2个解决方案来修复它:
You've 2 options to fix it:
- 用
get
前缀重命名吸气剂. - 将
Boolean
替换为boolean
.请注意,它将默认为false
而不是null
.
- Rename the getter with
get
prefix. - Replace
Boolean
byboolean
. Note that it will default tofalse
instead ofnull
.
另请参见:
- JavaBeans规范-第8.3.2章
- Java如何运行表达式语言解析布尔属性? (在JSF 1.2中)
- JavaBeans specification - chapter 8.3.2
- How does Java expression language resolve boolean attributes? (in JSF 1.2)
See also:
无关与具体问题无关,类路径对于EL实现似乎是一团糟.消息Missing Resource in EL implementation: ???propertyNotReadable???
表示EL impl无法在自己的JAR中找到相关的错误消息,该错误消息应如下所示
Unrelated to the concrete problem, the classpath seems to be a mess as to EL implementation. The message Missing Resource in EL implementation: ???propertyNotReadable???
indicates that the EL impl wasn't able to find the associated error message in own JAR which should look like this
Property 'matriz' not found on type com.example.MyBean
确保没有在/WEB-INF/lib
中任意下载EL JAR文件.摆脱它们. servlet容器已经提供了自己的容器.
Make sure that you don't have arbitrarily downloaded EL JAR files in /WEB-INF/lib
. Get rid of them. The servletcontainer already provides its own.
这篇关于以"is"开头的布尔属性不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!