Error : javax.el.PropertyNotFoundException: Target Unreachable, 'null' returned null [duplicate]

岁酱吖の 提交于 2019-12-03 02:41:21

You have no property firstName in your entity staff

UPDATE:

Looks like your staffobject is null add:

@PostConstruct
public void init() {
    staff = new Stuff();
}
BatScream

The error suggests that when the "firstName" is being accessed, it cannot be reached. So the "Staff" has not been constructed yet.

Add a method to your managed bean, this will resolve the issue.

@PostConstruct
public void init() {
    staff= new Staff ();
}

For better understanding of why you should do it that way and not

Staff staff = new Staff();

JSF - what is the difference between @PostConstruct and direct method call from constructor?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!