I’m facing a strange problem. My page can not find a property that has public acessors (get and set) and is initialized. The error presented is:
javax.el.PropertyNotFoundException: /empresa.xhtml @77,68 value="#{empresaManager.empresaEdit.cdEmp}": Target Unreachable, 'empresaEdit' returned null
public class Empresa implements Serializable {
private Integer cdEmp;
private String deEmp;
private String nmFtsEmp;
/* getters and setters */
}
@ManagedBean(name="empresaManager")
@SessionScoped
public class EmpresaManager extends Base4AllActions implements Serializable, Actions4AllButtons {
private static final long serialVersionUID = 1L;
private static EmpresaTransaction empresaTransaction;
private Empresa empresaEdit = new Empresa();
private List<Empresa> empresas = new ArrayList<>();
private String deEmpresaFind;
private String tpPsq;
private final static String TPPSQ_BYNAME = "NAME";
private final static String TPPSQ_BYFANTASY = "FANTASY";
public EmpresaManager() {
super();
empresaTransaction = new EmpresaTransaction();
this.tpPsq = TPPSQ_BYNAME;
empresaEdit = new Empresa();
this.setNone();
}
public Empresa getEmpresaEdit() {
return empresaEdit;
}
public void setEmpresaEdit(Empresa empresaEdit) {
this.empresaEdit = empresaEdit;
}
/* getters, setters and other methods */
}
<p:outputLabel value="#{prompt['empresa-cdEmp']}" for="cdEmp" />
<p:inputText id="cdEmp" value="#{empresaManager.empresaEdit.cdEmp}" required="false"
size="3" maxlength="4" readonly="#{empresaManager.key}" />
<h:message for="cdEmp" styleClass="errors" />
I'm using Primefaces Icarus Premium Layout that uses Primefaces 6.0