package com;
import java.util.ArrayList;
import java.util.Collection;
import java.sql.*;
public class GoodsBean
{
private Connection con;
PageNumber pageNumber=new PageNumber();
int rowCount=1;
int showPage=16;
int pageCount=1;
public GoodsBean()
{
try
{
con = DBConnection.getConnection();
}
catch(Exception e)
{
e.printStackTrace();
}
}
public int getRowCount()
{
return rowCount;
}
public int getAllPage()
{
try
{
Statement statement = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
ResultSet resultset = statement.executeQuery("select * from Goods");
resultset.last();
rowCount=resultset.getRow();
pageNumber.setPageCount(rowCount,showPage);
pageCount=pageNumber.getPageCount();
}
catch(Exception e)
{
e.printStackTrace();
}
return pageCount;
}
public int getAllPageBySort(String s)
{
try
{
Statement statement = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
ResultSet resultset = statement.executeQuery("select * from Goods where sortName='" + s + "'");
resultset.last();
rowCount=resultset.getRow();
pageNumber.setPageCount(rowCount,showPage);
pageCount=pageNumber.getPageCount();
}
catch(Exception e)
{
e.printStackTrace();
}
return pageCount;
}
public int getAllPageByPrice(String s)
{
int a=s.indexOf("-");
float one=Float.parseFloat(s.substring(0,a));
float two=Float.parseFloat(s.substring(a+1));
try
{
Statement statement = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
ResultSet resultset = statement.executeQuery("select * from Goods where goodsPrice between "+one+" and "+two);
resultset.last();
rowCount=resultset.getRow();
pageNumber.setPageCount(rowCount,showPage);
pageCount=pageNumber.getPageCount();
}
catch(Exception e)
{
e.printStackTrace();
}
return pageCount;
}
public int getAllPageByMaterial(String s)
{
try
{
Statement statement = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
ResultSet resultset = statement.executeQuery("select * from Goods where goodsmaterial like '%"+s+"%'");
resultset.last();
rowCount=resultset.getRow();
pageNumber.setPageCount(rowCount,showPage);
pageCount=pageNumber.getPageCount();
}
catch(Exception e)
{
e.printStackTrace();
}
return pageCount;
}
public Collection getAllGoods(int s)
{
GoodsClass goods;
ArrayList arraylist = new ArrayList();
try
{
Statement statement = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
ResultSet resultset = statement.executeQuery("select * from Goods");
int count=0;
if(s!=0)
{
resultset.absolute(s*16);
}
while(resultset.next())
{
goods = new GoodsClass();
int i=resultset.getInt(1);
String s1=resultset.getString(2);
String s2=resultset.getString(3);
String s3=resultset.getString(4);
String s4=resultset.getString(5);
float f=resultset.getFloat(6);
String s5=resultset.getString(7);
String s6=resultset.getString(8);
String s7=resultset.getString(9);
String s8=resultset.getString(10);
String s9=resultset.getString(11);
goods.setGoodsId(i);
goods.setGoodsName(s1);
goods.setGoodsmaterial(s2);
goods.setGoodsPackage(s3);
goods.setGoodsLanguage(s4);
goods.setGoodsPrice(f);
goods.setGoodsCent(s5);
goods.setGoodsScope(s6);
goods.setGoodsPlace(s7);
goods.setGoodsHabitus(s8);
goods.setSortName(s9);
arraylist.add(goods);
count++;
if(count==16)
{
break;
}
}
con.close();
}
catch(Exception e)
{
e.printStackTrace();
}
return arraylist;
}
public Collection getGoodsBySort(String s,int pageCount)
{
GoodsClass goods;
ArrayList arraylist = new ArrayList();
try
{
Statement statement = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
ResultSet resultset = statement.executeQuery("select * from Goods where sortName='" + s + "'");
int count=0;
if(pageCount!=0)
{
resultset.absolute(pageCount*16);
}
while(resultset.next())
{
goods = new GoodsClass();
int i=resultset.getInt(1);
String s1=resultset.getString(2);
String s2=resultset.getString(3);
String s3=resultset.getString(4);
String s4=resultset.getString(5);
float f=resultset.getFloat(6);
String s5=resultset.getString(7);
String s6=resultset.getString(8);
String s7=resultset.getString(9);
String s8=resultset.getString(10);
String s9=resultset.getString(11);
goods.setGoodsId(i);
goods.setGoodsName(s1);
goods.setGoodsmaterial(s2);
goods.setGoodsPackage(s3);
goods.setGoodsLanguage(s4);
goods.setGoodsPrice(f);
goods.setGoodsCent(s5);
goods.setGoodsScope(s6);
goods.setGoodsPlace(s7);
goods.setGoodsHabitus(s8);
goods.setSortName(s9);
arraylist.add(goods);
count++;
if(count==16)
{
break;
}
}
statement.close();
con.close();
}
catch(Exception e)
{
e.printStackTrace();
}
return arraylist;
}
public Collection getGoodsByPrice(String s,int pageCount)
{
int a=s.indexOf("-");
float one=Float.parseFloat(s.substring(0,a));
float two=Float.parseFloat(s.substring(a+1));
GoodsClass goods;
ArrayList arraylist = new ArrayList();
try
{
Statement statement = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
ResultSet resultset = statement.executeQuery("select * from Goods where goodsPrice between "+one+" and "+two);
int count=0;
if(pageCount!=0)
{
resultset.absolute(pageCount*16);
}
while(resultset.next())
没有合适的资源?快使用搜索试试~ 我知道了~
基于JSP+JavaBean的网上花店
共1124个文件
gif:550个
jpg:391个
jsp:79个
5星 · 超过95%的资源 需积分: 10 122 下载量 161 浏览量
2009-03-18
14:45:25
上传
评论 1
收藏 5.83MB RAR 举报
温馨提示
包括:用户登录、商品查询、购物车、用户留言、管理员管理等模块和系统过滤器。
资源推荐
资源详情
资源评论
收起资源包目录
基于JSP+JavaBean的网上花店 (1124个子文件)
top.asp 159B
menu.asp 159B
GoodsBean.class 13KB
GoodsBean.class 11KB
Cart.class 6KB
UserBean.class 6KB
LeaveLauguageBean.class 5KB
Cart.class 5KB
UserBean.class 5KB
ProduceBean.class 4KB
LeaveLauguageBean.class 4KB
AdminBean.class 3KB
ProduceBean.class 3KB
AdminBean.class 3KB
GoodsClass.class 3KB
SafeLogBean.class 2KB
UserClass.class 2KB
SignonFilter.class 2KB
SortBean.class 2KB
SafeLogBean.class 2KB
GoodsClass.class 2KB
UserClass.class 2KB
SignonFilter.class 2KB
SortBean.class 2KB
EncodingFilter.class 2KB
LeaveLanguageClass.class 2KB
SafeLogClass.class 1KB
LeaveLanguageClass.class 1KB
EncodingFilter.class 1KB
OrdersDetailsClass.class 1KB
OrdersClass.class 1KB
PageNumber.class 1KB
ProduceDetailsClass.class 1KB
SafeLogClass.class 1KB
AdminClass.class 961B
OrdersClass.class 954B
OrdersDetailsClass.class 951B
DBConnection.class 938B
ProduceDetailsClass.class 924B
PageNumber.class 912B
ProduceClass.class 782B
AdminClass.class 758B
SortClass.class 755B
DBConnection.class 731B
ProduceClass.class 623B
SortClass.class 599B
.classpath 340B
mt_style.css 12KB
mt_style.css 12KB
mt_style.css 12KB
mt_style.css 12KB
mt_style.css 12KB
mt_style.css 12KB
mt_style.css 12KB
mt_style.css 12KB
mt_style.css 12KB
style.css 1KB
qq.css 493B
qq.css 493B
qq.css 493B
qq.css 493B
css.css 373B
css.css 373B
css.css 373B
css.css 373B
4.gif 87KB
5.gif 79KB
3109.gif 48KB
3107.gif 43KB
3047.gif 42KB
liucheng1.gif 42KB
liucheng1.gif 42KB
3043.gif 40KB
Admin_Login1.gif 25KB
cart04.gif 21KB
cart04.gif 21KB
cart02.gif 14KB
cart02.gif 14KB
help.gif 12KB
Admin_Login2.gif 10KB
logo_market.gif 8KB
logo_market.gif 8KB
logo_market.gif 8KB
chuntian.gif 7KB
chuntian.gif 7KB
chuntian.gif 7KB
Admin_Login3.gif 7KB
title_r1_c1.gif 5KB
title_r1_c1.gif 5KB
title_r1_c1.gif 5KB
title_r1_c1.gif 5KB
title_r1_c1.gif 5KB
title_r1_c1.gif 5KB
title_r1_c1.gif 5KB
title_r1_c1.gif 5KB
title_r1_c1.gif 5KB
title_r1_c1.gif 5KB
title_r1_c1.gif 5KB
title_r1_c1.gif 5KB
title_r1_c1.gif 5KB
共 1124 条
- 1
- 2
- 3
- 4
- 5
- 6
- 12
资源评论
- XISON_CHEN2015-02-09有错,不过值得参考
- luckdst2014-05-26是myeclipse的,很好,值得参考,谢谢分享
chenyanwen_321
- 粉丝: 1
- 资源: 3
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- C语言基础-C语言编程基础之Leetcode编程题解之第39题组合总和.zip
- C语言基础-C语言编程基础之Leetcode编程题解之第38题外观数列.zip
- C语言基础-C语言编程基础之Leetcode编程题解之第37题解数独.zip
- C语言基础-C语言编程基础之Leetcode编程题解之第36题有效的数独.zip
- C语言基础-C语言编程基础之Leetcode编程题解之第35题搜索插入位置.zip
- index.wxml
- C语言基础-C语言编程基础之Leetcode编程题解之第33题搜索旋转排序数组.zip
- 基于Python实现的手写数字识别系统源码.zip
- 从网页提取禁止转载的文字
- C语言基础-C语言编程基础之Leetcode编程题解之第32题最长有效括号.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功