Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jsf-2/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jakarta ee 无法访问目标,返回null_Jakarta Ee_Jsf 2_Primefaces - Fatal编程技术网

Jakarta ee 无法访问目标,返回null

Jakarta ee 无法访问目标,返回null,jakarta-ee,jsf-2,primefaces,Jakarta Ee,Jsf 2,Primefaces,尝试使用对象currentActeurObjetProjet并使用Primefaces在对话框上显示其属性时遇到问题,但它始终显示此错误: 注意:/infoprojet.xhtml@493159 value=“#{ACTEUROBJETPROJET.currentActeurObjetProjet.objets.nomObjet}”:无法访问目标,“objets”返回空值 javax.el.PropertyNotFoundException:/infoprojet.xhtml@493159 va

尝试使用对象currentActeurObjetProjet并使用Primefaces在对话框上显示其属性时遇到问题,但它始终显示此错误:

注意:/infoprojet.xhtml@493159 value=“#{ACTEUROBJETPROJET.currentActeurObjetProjet.objets.nomObjet}”:无法访问目标,“objets”返回空值 javax.el.PropertyNotFoundException:/infoprojet.xhtml@493159 value=“#{acteurObjetProjetBean.currentActeurObjetProjet.ObjJets.nomObjet}”:无法访问目标,“ObjJets”返回空值

下面是备份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;
    } 
    .......
} 
这是我的页面代码:

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

问候

javax.el.PropertyNotFoundException:/infoprojet.xhtml@493159 value=“#{acteurObjetProjetBean.currentActeurObjetProjet.ObjJets.nomObjet}”:无法访问目标,“ObjJets”返回空值

EL试图告诉您它无法设置
nomObjet
值,因为
objet
null
。EL不会为您自动创建任何嵌套对象属性。它只会自动填充叶属性。您只需确保
currentActeurObjetProject
类的
objet
属性不是
null
。您可以通过在
ActeurObjetProjet
类的构造函数中准备它来实现这一点

public ActeurObjetProjet() {
    this.objet = new Objet();
}
您也可以在
ActeurObjetProjetBean
的构造函数中执行此操作

private ActeurObjetProjet currentActeurObjetProject;

public ActeurObjetProjetBean() {
    this.currentActeurObjetProject = new ActeurObjetProjet();
    this.currentActeurObjetProject.setObject(new Object());
}

选择最适合功能/业务需求的对象。

可能是缺少某些getter/setter,或者对象(属性)未正确初始化。您确定
objets
已正确初始化,并且在
ActeurObjetProjet
中具有getter/setter吗。