Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/jsf/5.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
Jsf 嵌套bean属性,异常:目标不可访问,';空';返回空值_Jsf_El - Fatal编程技术网

Jsf 嵌套bean属性,异常:目标不可访问,';空';返回空值

Jsf 嵌套bean属性,异常:目标不可访问,';空';返回空值,jsf,el,Jsf,El,在一对一的关系中,我不能坚持使用ADRESE字段,但我没有在学校字段中得到错误。给出以下错误: javax.el.PropertyNotFoundException: /inscription/school-inscription.xhtml @29,91 value="#{createBn.school.adresse.country}": Target Unreachable, 'null' returned null 以下是视图: <h:inputText id="name" va

在一对一的关系中,我不能坚持使用ADRESE字段,但我没有在学校字段中得到错误。给出以下错误:

javax.el.PropertyNotFoundException: /inscription/school-inscription.xhtml @29,91 value="#{createBn.school.adresse.country}": Target Unreachable, 'null' returned null
以下是视图:

<h:inputText id="name" value="#{createBn.school.name}" pt:placeholder="ex: Dalton" />

<h:inputText value="#{createBn.school.creationDate}" pt:placeholder="31-12-2000" />

<h:selectOneMenu value="#{createBn.school.adresse.country}" styleClass="form-control">
    <f:selectItems value="#{countriesList.countries}" />
</h:selectOneMenu>.....
以下是学校实体和地址实体:

@Entity
@Table(schema = "school", name = "school")
public class School implements Serializable {
....
private String name;

@OneToOne @JoinColumn(name = "adressId")
private Adresse adresse;
//getters +setters
地址:

@Entity
@Table(schema = "school", name = "adress")
class Adresse implements java.io.Serializable {
..
private String country;
//getters +setters
Ps:我已经在这里看到了类似的情况,但是没有任何帮助+我删除了这里发布的大部分代码,比如ID字段,因此,所有getter和setter都实现了

value=“#{createBn.school.adresse.country}”
:无法访问目标,“null”返回null

这意味着以下值之一为
null

  • {createBn}
  • {createBn.school}
  • {createBn.school.adresse}
createBn
乍一看是正常的(否则也会有其他问题)。使用
新学校()
显式创建的
学校看起来不错。然而,我在任何地方都看不到这一点。相应地修复它

school.setAdresse(new Adresse());
school.setAdresse(new Adresse());