以"is"开头的布尔属性不起作用 [英] boolean properties starting with "is" does not work

查看:179
本文介绍了以"is"开头的布尔属性不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用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:

  1. get前缀重命名吸气剂.
  2. Boolean替换为boolean.请注意,它将默认为false而不是null.
  1. Rename the getter with get prefix.
  2. Replace Boolean by boolean. Note that it will default to false instead of null.

另请参见:

  • JavaBeans规范-第8.3.2章
  • Java如何运行表达式语言解析布尔属性? (在JSF 1.2中)
  • See also:

    • JavaBeans specification - chapter 8.3.2
    • How does Java expression language resolve boolean attributes? (in JSF 1.2)
    • 无关与具体问题无关,类路径对于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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆