HTTP Status 500 - An exception occurred processing JSP page /product_l
查询产品列表
请输入产品名称
[table]
[tr]
[td]产品编号[/td]
[td]产品名称[/td]
[td]产品价格[/td]
[td]产品信息[/td]
[/tr]
0) { flag = true; }
this.pstmt.close();
return flag;
}
public List findAll(String product_name) throws Exception{
List list = new ArrayList();
String sql = "select product_id,product_name,price,info from product";
if(product_name!=null&&!"".equals(product_name)){
sql = "select product product_id,product_name,price,info from product where product_name like? ";
this.pstmt.setString(1, "%" + product_name + "%" );
}
else {
this.pstmt = this.conn.prepareStatement(sql);
}
ResultSet rs = this.pstmt.executeQuery();
Product product = null;
while (rs.next()){
product = new Product();
product.setProduct_id(rs.getString(1));
product.setProduct_name(rs.getString(2));
product.setPrice(rs.getDouble(3));
product.setInfo(rs.getString(4));
list.add(product);
}
this.pstmt.close();
return list;
}
public Product findByProductId(String product_id) throws Exception{
Product product = null;
String sql ="select product_id,product_name,price,info from product where product_id =?";
this.pstmt = this .conn .prepareStatement(sql);
this.pstmt.setString(1, product_id);
ResultSet rs = this.pstmt.executeQuery();
if (rs.next()) {
product = new Product();
product.setProduct_id(rs.getString(1));
product.setProduct_name(rs.getString(2));
product.setPrice(rs.getDouble(3));
product.setInfo(rs.getString(4));
}
this.pstmt.close();
return product ;
}
} |
免责声明:本内容仅代表回答会员见解不代表天盟观点,请谨慎对待。
版权声明:作者保留权利,不代表天盟立场。
|
|
|
|
List list= DAOFactory.getIEmpDAOInstance().findAll(product_name);
看下这个list有没有取到值,怀疑没有取到值 |
|
|
|
|
其他都是不报错的,然后我还有俩JSP页面,添加数据进入数据库的那个JSP是可以的,但是这个查询的却报了这个我怎么找都找不出错的错。 |
|
|
|
|