主题:[讨论]帮帮看看哪里不对
下拉列表类
public ArrayList JSselet() {
String sql = "select * from t_rkdt";
conn = db.getDBManager();
try {
ArrayList list = new ArrayList();
pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery();
while (rs.next()) {
StoreBean bean = new StoreBean();
bean.setHzh(rs.getString("hzh"));
bean.setHzmc(rs.getString("hzmc"));
bean.setKwh(rs.getString("kwh"));
bean.setSpmc(rs.getString("spmc"));
bean.setJz(rs.getFloat("jz"));
bean.setJs(rs.getInt("js"));
bean.setZl(rs.getFloat("zl"));
list.add(bean);
}
} catch (Exception ex) {
ex.printStackTrace();
}
return (ArrayList) list;
}
Action类
public ActionForward execute(ActionMapping actionMapping,
ActionForm actionForm,
HttpServletRequest servletRequest,
HttpServletResponse servletResponse) {
StoreForm storeForm = (StoreForm) actionForm;
Chuku cks= new Chuku();
List list = cks.JSselet();
servletRequest.setAttribute("list",list);
return actionMapping.findForward("chuku");
}
JSP页面
<%@page contentType="text/html; charset=GBK" %>
<%@taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<%@taglib uri="/WEB-INF/struts-template.tld" prefix="template"%>
<%@page import="bean.StoreBean" %>
<html:html>
<head>
<title>Chuku</title>
</head>
<body bgcolor="#ffffff
<h1>出库</h1>
<html:form action="ChukuAction.do" method="POST">
<logic:notEmpty name="list">
<html:select property="StoreForm.spmc">
<html:options collection="list" labelProperty="hubm" property="spmc" />
</html:select>
</logic:notEmpty>
<input type="submit" name="Submit" value="提交">
<input type="reset" value="重置">
</html:form>
</body>
</html:html>
大家帮忙看看哪错了谢谢
public ArrayList JSselet() {
String sql = "select * from t_rkdt";
conn = db.getDBManager();
try {
ArrayList list = new ArrayList();
pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery();
while (rs.next()) {
StoreBean bean = new StoreBean();
bean.setHzh(rs.getString("hzh"));
bean.setHzmc(rs.getString("hzmc"));
bean.setKwh(rs.getString("kwh"));
bean.setSpmc(rs.getString("spmc"));
bean.setJz(rs.getFloat("jz"));
bean.setJs(rs.getInt("js"));
bean.setZl(rs.getFloat("zl"));
list.add(bean);
}
} catch (Exception ex) {
ex.printStackTrace();
}
return (ArrayList) list;
}
Action类
public ActionForward execute(ActionMapping actionMapping,
ActionForm actionForm,
HttpServletRequest servletRequest,
HttpServletResponse servletResponse) {
StoreForm storeForm = (StoreForm) actionForm;
Chuku cks= new Chuku();
List list = cks.JSselet();
servletRequest.setAttribute("list",list);
return actionMapping.findForward("chuku");
}
JSP页面
<%@page contentType="text/html; charset=GBK" %>
<%@taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<%@taglib uri="/WEB-INF/struts-template.tld" prefix="template"%>
<%@page import="bean.StoreBean" %>
<html:html>
<head>
<title>Chuku</title>
</head>
<body bgcolor="#ffffff
<h1>出库</h1>
<html:form action="ChukuAction.do" method="POST">
<logic:notEmpty name="list">
<html:select property="StoreForm.spmc">
<html:options collection="list" labelProperty="hubm" property="spmc" />
</html:select>
</logic:notEmpty>
<input type="submit" name="Submit" value="提交">
<input type="reset" value="重置">
</html:form>
</body>
</html:html>
大家帮忙看看哪错了谢谢