我想在主页上显示数据库中的数据列表,但出现以下错误
org.springframework.expression.spel.SpelEvaluationException: EL1004E:(pos 8): Method call: Method listAnnonce() can not be found on sujet.projet.collocation.domain.Annonce type at
用户.java
@Entity
@Table( name = "utilisateur" )
public class UserEntity extends BaseEntity {
// attribut
@OneToMany( mappedBy = "annonceUser" )
private List<Annonce> annonce;
public List<Annonce> getAnnonce() {
return annonce;
}
public void setAnnonce( List<Annonce> annonce ) {
this.annonce = annonce;
} //getter setter
}
接口.java
public List<Annonce> liste();
接口Impl.java
public List<Annonce> liste() {
return annonceDao.findAll();
}
主流.xml
<var name="annonce" class="sujet.projet.collocation.domain.User"/>
<view-state id="accueil" view="accueil.xhtml" model="annonce">
<on-render>
<evaluate expression="annonce.list()"/>
</on-render>
<transition on="toauthentification" to="authentification" />
</view-state>
Annonce.java
@Entity
@Table( name = "annonce" )
public class Annonce extends BaseEntity {
//attribut
@ManyToOne
@JoinColumn( name = "annonceUser" )
private User annonceUser;
public User getAnnonceUser() {
return annonceUser;
}
public void setAnnonceUser( User annonceUser ) {
this.annonceUser = annonceUser;
}
//getter&setter
}
有人可以帮助我或建议我解决方案吗?