hibernate查詢結果Logic:iterate問題

znjq發表於2003-09-16
=========================Bzqj.java==============================
package strutshibernate;

import java.io.*;

public class Bzqj {
private String jgbh;
private int bh;
private String mc;
private int bz;
public Bzqj(){}
public String getJgbh() {
return jgbh;
}
public void setJgbh(String jgbh) {
this.jgbh = jgbh;
}
public int getBh() {
return bh;
}
public void setBh(int bh) {
this.bh = bh;
}
public String getMc() {
return mc;
}
public void setMc(String mc) {
this.mc = mc;
}
public int getBz() {
return bz;
}
public void setBz(int bz) {
this.bz = bz;
}
}
====================DBAction.java部分=========================
Configuration cfg = new Configuration().addClass(Bzqj.class);
SessionFactory sessions = cfg.buildSessionFactory();
Session s = sessions.openSession();
Query q = s.createQuery("from Bzqj");
List result = q.list();
httpServletRequest.setAttribute("resultlist", result);
s.close();
System.out.println("##result"+result);
return (actionMapping.findForward("list")); }
===================list.jsp==========================
<%@ page language="java" %>
<%@ page import="java.util.*"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ page contentType="text/html; charset=GBK" %>
<html:html locale="true">
<head>
<title>
list
</title>
</head>
<body bgcolor="ffffff">
<table>
<logic:iterate id="a" name="resultlist" scope="request" property="strutshibernate.Bzqj" >
<tr>
<td>JGBH:<bean:write name="a" property="jgbh" filter="true"/></td>
</tr>
</logic:iterate>
</table>
</body>
</html:html>
=====================老是報錯=====================
org.apache.jasper.JasperException: No getter method for property strutshibernate.Bzqj of bean resultlist
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:254)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
....

=========
快瘋了,幫忙啊~~

相關文章