System.out.println(e.toString());
return null;
}
}
public int getPageCount() {
try {
//编写查询数据库信息的 SQL 语句
String sql = "select count(*) from goods";
DBBean db = new DBBean();
ResultSet rs=db.executeQuery(sql,null);
int number=0;
if(rs.next())
number = rs.getInt(1);
db.close();
return (number - 1) / 10 + 1;
} catch (Exception e) {
return 0;
}
}
}
2.2 Item 类
package javabean;
// 购物项
public class Item
{
private Goods goods;
private int quantity;
public Item(Goods d,int quantity)
{
this.goods = d;
this.quantity = quantity;
}
public void setGoods(Goods goods){
this.goods = goods;
}
public Goods getGoods()
{
return goods;
}
public void setQuantity(int quantity)
{
this.quantity = quantity;
}