dao :
//通过id查找所有的数据
public List getAllq(int n) {
// TODO Auto-generated method stub
li=new ArrayList();
String sql="select * from tb_goods";
try {
con=DBHelper.getcon();
ps=con.prepareStatement(sql);
rs=ps.executeQuery();
while (rs.next()) {
Goods q=new Goods(rs.getInt(1), rs.getString(2), rs.getInt(3), rs.getString(4), rs.getInt(5), rs.getInt(6), rs.getString(7), rs.getString(8));
li.add(q);
}
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}finally{
DBHelper.close(con, ps, rs);
}
return li;
}
在jsp页面调dao方法
<%
int nid=Integer.parseInt(request.getParameter("nid"));
out.print(nid);
List<Goods> li=new GoodsBizimpl().getAllq(nid);--我感觉这有点问题
for(Goods g:li){
。。。。。。
}