Javax.el.PropertyNotFoundException: class 'xxx' has no readable property 'yyy'
I am using below managed CDI bean:
@Named
@SessionScoped
public class RegisterController implements Serializable {
private static final long serialVersionUID = 1L;
@Inject
private MitgliedAbc mitgliedAbc;
public MitgliedAbc getMitgliedABC() {
return mitgliedAbc;
}
public void setMitgliedAbc (MitgliedAbc mitgliedAbc) {
this.mitgliedAbc = mitgliedAbc;
}
}
And the following input in JSF form:
<h:inputText value="#{registerController.mitgliedAbc.mgEmail}" />
When deploying to GlassFish 4.1 and opening the page in a browser, the following exception is thrown:
javax.el.PropertyNotFoundException: /register.xhtml @ 27.66 value = "# {registerController.mitgliedAbc.mgEmail}": class 'com.example.RegisterController' does not have a readable property 'mitgliedAbc'.
How is this caused and how can I solve it?
source to share
javax.el.PropertyNotFoundException: class 'xxx' has no readable property 'yyy'
This basically means that the class xxx
doesn't have a (valid) getter for the property yyy
.
In other words, the following EL expression that should output a value is
#{xxx.yyy}
could not find method public Yyy getYyy()
in class xxx
.
In your specific case with the following EL expression
#{registerController.mitgliedAbc}
he could not find the property public MitgliedAbc getMitgliedAbc()
.
Indeed, this method does not exist. It was called getMitgliedABC()
instead getMitgliedABC()
.
Correct the method name to match exactly getYyy()
.
public MitgliedAbc getMitgliedAbc() {
return mitgliedAbc;
}
source to share