i’m experiencing problems while trying to use the object currentActeurObjetProjet and display its attributes on a dialog using Primefaces but it keeps showing this error:
ATTENTION: /infoprojet.xhtml @493,159 value=”#{acteurObjetProjetBean.currentActeurObjetProjet.objets.nomObjet}”: Target Unreachable, ‘objets’ returned null
javax.el.PropertyNotFoundException: /infoprojet.xhtml @493,159 value=”#{acteurObjetProjetBean.currentActeurObjetProjet.objets.nomObjet}”: Target Unreachable, ‘objets’ returned null
here is the back up bean:
package com.mycompany.projet;
.......
/**
*
* @author Omar
*/
@Component("etatsBean")
@Scope("session")
public class ActeurObjetProjetBean implements Serializable{
.......
private ActeurObjetProjet currentActeurObjetProjet=new ActeurObjetProjet();
.......
////////////////////////////////////////////////////////// Méthodes & fonctions\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
////////////////////////////////////////////////////////// setters & getters \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
public void setCurrentActeurObjetProjet(ActeurObjetProjet currentActeurObjetProjet)
{
this.currentActeurObjetProjet=currentActeurObjetProjet;
}
public ActeurObjetProjet getCurrentActeurObjetProjet()
{
return currentActeurObjetProjet;
}
.......
}
here is my page code:
<p:dialog header="Editer Objet" widgetVar="editobjetDialog" resizable="true" width="300" height="300" showEffect="clip" hideEffect="clip" modal="true">
<p:outputPanel id="editobjetDetail" style="text-align:center;" layout="block">
<center>
<h:panelGrid columns="2" cellpadding="5">
<h:outputLabel value="Nom Objet "/>
<p:inputText value="#{acteurObjetProjetBean.currentActeurObjetProjet.objets.nomObjet}" style="width: 180px"/>
<h:outputLabel value="Accès DB2 "/>
<p:inputText value="#{acteurObjetProjetBean.currentActeurObjetProjet.objets.accesDb2}" style="width: 180px"/>
<h:outputLabel value="Etat "/>
<p:inputText value="#{acteurObjetProjetBean.currentActeurObjetProjet.objets.etatObjet}" style="width: 180px"/>
<h:outputLabel value="Version "/>
<p:inputText value="#{acteurObjetProjetBean.currentActeurObjetProjet.objets.versionObjet}" style="width: 180px"/>
</h:panelGrid>
</center>
</p:outputPanel>
</p:dialog>
Regards
EL is trying to tell you that it cannot set the
nomObjetvalue becauseobjetsisnull. EL won’t autocreate any nested object properties for you. It will only autofill the leaf property. You just have to make sure that theobjetproperty of thecurrentActeurObjetProjectclass is notnull. You can do that by preparing it in for example the constructor of theActeurObjetProjetclass.You can also do that in the constructor of
ActeurObjetProjetBeaninstead.Choose whatever suits the functional/business requirements the best.