我有一个用hibernate设置的数据库。在jsp页面中,我显示了一个用于插入值的表单,并将这些值传递到java类中,然后java类将该条目保存到数据库中,这很好用,但是当我想显示表中的数据时,它会给出错误消息。
org.apache.jasper.el.JspPropertyNotFoundException: /list_object.jsp(45,0) '${objectManager.allObjects}' The class 'ObjectManager$$EnhancerByCGLIB$$b2d7311' does not have the property 'allObjects'对于这条线
<c:forEach var="object" items="${objectManager.allObjects}">在……里面
<c:forEach var="object" items="${objectManager.allObjects}">
<tr>
<td><c:out value="${object.objectID}"/></td>
<td><c:out value="${object.objectRule}"/></td>
</tr>
</c:forEach>我认为这是Hibernate-Proxy-Object的问题,但我用下面的代码对另一个表/bean运行了相同的操作
<c:forEach var="object" items="${objectManager.allLayouts}">它运行得非常好。我检查了xml配置文件和hbm.xml配置,bean设置正确。我不知道这个错误是从哪里产生的,也不知道为什么它只适用于一个Spring-bean,而不适用于另一个
编辑:
@Transactional
public class ObjectManager{
private SessionFactory sessionFactory;
public void saveObject(Objects object){
getCurrentSession().save(object);
}
@SupressWarnings("unchecked")
public Iterable<Objects> getAllObjects(){
return getCurrentSession().createCriteria(Objects.class)
.addOrder(Order.desc("objectID"))
.list():
}发布于 2012-06-07 02:30:41
我认为这个错误是不言而喻的。
objectManager对象没有getAllObjects()方法。
您的工作示例使用的是一个不同的方法- getAllLayouts()。
https://stackoverflow.com/questions/10919824
复制相似问题