このようにセッションからの情報を表示したいJSPページがあります
<div>Fonction : <s:property value="%{#session.employe.emploi.nomEmploi}"/>
しかし、何も表示されないという問題。
説明するために、別のクラス従業員を含む従業員クラスがあります。サンプルコードは次のとおりです
従業員:
public class Employe
{
private Long employeId;
private Emploi emploi;
private String nom;
private String prenom;
private String adresse;
private String civilite;
@Id
@GeneratedValue(strategy = IDENTITY)
@Column(name = "ID", unique = true, nullable = false)
public Long getEmployeId() {
return this.employeId;
}
public void setEmployeId(Long employeId) {
this.employeId = employeId;
}
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "EMP_ID", nullable = false)
public Emploi getEmploi() {
return this.emploi;
}
public void setEmploi(Emploi emploi) {
this.emploi = emploi;
}
@Column(name = "NOM", nullable = false)
public String getNom() {
return this.nom;
}
public void setNom(String nom) {
this.nom = nom;
}
@Column(name = "PRENOM", nullable = false)
public String getPrenom() {
return this.prenom;
}
public void setPrenom(String prenom) {
this.prenom = prenom;
}
@Column(name = "ADRESSE", nullable = false)
public String getAdresse() {
return this.adresse;
}
public void setAdresse(String adresse) {
this.adresse = adresse;
}
@Column(name = "CIVILITE", nullable = false, length = 20)
public String getCivilite() {
return this.civilite;
}
public void setCivilite(String civilite) {
this.civilite = civilite;
}
}
従業員:
public class Emploi
{
private Long emploiId;
private String nomEmploi;
private Set<Employe> employes = new HashSet<Employe>(0);
@Id
@GeneratedValue(strategy = IDENTITY)
@Column(name = "EMP_ID", unique = true, nullable = false)
public Long getEmploiId() {
return this.emploiId;
}
public void setEmploiId(Long emploiId) {
this.emploiId = emploiId;
}
@Column(name = "NOM_EMPLOI", nullable = false)
public String getNomEmploi() {
return this.nomEmploi;
}
public void setNomEmploi(String nomEmploi) {
this.nomEmploi = nomEmploi;
}
@OneToMany(fetch = FetchType.LAZY, mappedBy = "emploi")
public Set<Employe> getEmployes() {
return this.employes;
}
public void setEmployes(Set<Employe> employes) {
this.employes = employes;
}
}
どんな助けでも大歓迎です。
前もって感謝します。