• 大小: 2.41MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-09-05
  • 语言: Java
  • 标签: 网上书城  

资源简介

使用JSP,servlet和jdbc技术开发网上书城

资源截图

代码片段和文件信息

package com.pb.dao;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import com.pb.entity.Bill;
import com.pb.util.Conbase;

public class BillDao {
private Connection conn;
private PreparedStatement pstmt;
private ResultSet rs;
/*
 * 查询账单
 */
public List getBill(){
String sql=“select * from zhou_bill“;
conn = Conbase.getCon();
List list = new ArrayList();
try {
pstmt=conn.prepareStatement(sql);
rs=pstmt.executeQuery();
while(rs.next()){
Bill bill= new Bill();
bill.setBillId(rs.getInt(“billId“));
bill.setGoodsName(rs.getString(“goodsName“));
bill.setGoodsNum(rs.getInt(“goodsNum“));
bill.setGoodsPrice(rs.getDouble(“goodsPrice“));
bill.setIsPayed(rs.getString(“isPayed“));
bill.setSupplierName(rs.getString(“supplierName“));
bill.setGoodsDescription(rs.getString(“goodsDescription“));
bill.setBillDate(rs.getDate(“billDate“));
bill.setGoodsUnit(rs.getString(“goodsUnit“));
list.add(bill);
}
} catch (SQLException e) {
e.printStackTrace();
}finally{
Conbase.closeAll(rs pstmt conn);
}
return list;
}
/*
 * 组合查询
 */
public List findFromBill(String goodsNameString isPayed){
String sql=“select * from zhou_bill where goodsName like ‘%“+goodsName+“%‘ and isPayed like ‘“+isPayed+“‘“ ;
conn=Conbase.getCon();
List list = new ArrayList();
try {

pstmt=conn.prepareStatement(sql);
rs=pstmt.executeQuery();
while(rs.next()){
Bill bill= new Bill();
bill.setBillId(rs.getInt(“billId“));
bill.setGoodsName(rs.getString(“goodsName“));
bill.setGoodsNum(rs.getInt(“goodsNum“));
bill.setGoodsPrice(rs.getDouble(“goodsPrice“));
bill.setIsPayed(rs.getString(“isPayed“));
bill.setSupplierName(rs.getString(“supplierName“));
bill.setGoodsDescription(rs.getString(“goodsDescription“));
bill.setBillDate(rs.getDate(“billDate“));
bill.setGoodsUnit(rs.getString(“goodsUnit“));
list.add(bill);
}
} catch (SQLException e) {
e.printStackTrace();
}finally{
Conbase.closeAll(rs pstmt conn);
}
return list;
}
/*
 * 添加账单
 */
public boolean addBill(Bill bill){
int billId = bill.getBillId();
String goodsName = bill.getGoodsName();
int goodsNum = bill.getGoodsNum();
double goodsPrice = bill.getGoodsPrice();
String isPayed = bill.getIsPayed();
String supplierName = bill.getSupplierName();
String goodsDescription = bill.getGoodsDescription();
String goodsUnit = bill.getGoodsUnit();
int bl=0;
String sql=“insert into zhou_bill(billIdgoodsNamegoodsNumgoodsPriceisPayedsupplierName“ +
“goodsDescriptionbillDategoodsUnit) values(“+billId+“‘“+goodsName+“‘“+goodsNum+““
        +goodsPrice+“‘“+isPayed+“‘‘“+supplierName+“‘‘“+goodsDescription+“‘sysdate‘“

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件        835  2015-07-25 12:23  booking\.classpath

     文件        395  2012-06-13 13:14  booking\.project

     文件        134  2012-08-23 17:17  booking\.settings\org.eclipse.core.resources.prefs

     文件        629  2012-06-05 16:35  booking\.settings\org.eclipse.jdt.core.prefs

     文件       5597  2012-06-16 14:52  booking\src\com\pb\dao\BillDao.java

     文件       6070  2012-06-11 20:31  booking\src\com\pb\dao\SupplierDao.java

     文件       6790  2012-06-11 21:07  booking\src\com\pb\dao\UserDao.java

     文件       1758  2012-06-08 17:00  booking\src\com\pb\entity\Bill.java

     文件       1609  2012-06-08 17:01  booking\src\com\pb\entity\Supplier.java

     文件       1536  2012-06-08 17:01  booking\src\com\pb\entity\User.java

     文件       6478  2012-06-11 18:26  booking\src\com\pb\servlet\BillServlet.java

     文件        892  2012-06-08 19:31  booking\src\com\pb\servlet\EncodingFilter.java

     文件       1663  2012-06-08 19:17  booking\src\com\pb\servlet\LoginServlet.java

     文件       6859  2012-06-11 20:05  booking\src\com\pb\servlet\SupplierServlet.java

     文件       6969  2012-06-14 07:36  booking\src\com\pb\servlet\UserServlet.java

     文件       1627  2012-06-13 13:10  booking\src\com\pb\util\Conbase.java

     文件        833  2012-06-13 13:08  booking\src\com\pb\util\Tools.java

     文件        106  2012-06-13 13:13  booking\src\db.properties

     文件       3445  2012-06-15 18:55  booking\WebRoot\bill_add.jsp

     文件       2957  2012-06-11 09:43  booking\WebRoot\bill_find.jsp

     文件       2956  2012-06-11 11:58  booking\WebRoot\bill_manager.jsp

     文件       4187  2012-06-15 18:55  booking\WebRoot\bill_update.jsp

     文件       1732  2012-06-07 08:57  booking\WebRoot\images\add_data.jpg

     文件       4114  2012-06-02 13:50  booking\WebRoot\images\bill_manager.jpg

     文件      13039  2012-06-02 12:44  booking\WebRoot\images\head.jpg

     文件      43564  2012-05-30 15:17  booking\WebRoot\images\login.JPG

     文件       3962  2012-06-02 13:50  booking\WebRoot\images\logout_pic.jpg

     文件       2287  2012-06-03 17:05  booking\WebRoot\images\stand_pic.jpg

     文件       4499  2012-06-02 13:50  booking\WebRoot\images\supplier_manager.jpg

     文件       3826  2012-06-02 13:50  booking\WebRoot\images\user_manager.jpg

............此处省略57个文件信息

评论

共有 条评论