Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.2k views
in Technique[技术] by (71.8m points)

jsf 2 - boolean properties starting with "is" does not work

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???

The getter is: isMatriz(). Should it be getMatriz()?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The is prefix works only for boolean, not Boolean.

You've there apparently actually a Boolean property.

You've 2 options to fix it:

  1. Rename the getter with get prefix.
  2. Replace Boolean by boolean. Note that it will default to false instead of null.

See also:


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

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...