通过传过来的id进行绑数据,代码如下

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){
            。。。。。。
            }

要看你goods的定义数据库的定义数据库的连接。有编译错误看什么错误,没有错误,运行看结果是否正确,有什么异常