资源简介
使用Servlet JSP实现,并没有使用框架。
代码片段和文件信息
package dao;
import cn.itcast.jdbc.TxQueryRunner;
import domain.Customer;
import domain.PageBean;
import org.apache.commons.collections.buffer.CircularFifoBuffer;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanHandler;
import org.apache.commons.dbutils.handlers.BeanListHandler;
import org.apache.commons.dbutils.handlers.ScalarHandler;
import java.util.ArrayList;
import java.util.List;
import java.util.spi.CurrencyNameProvider;
/**
* Created by codingBoy on 16/10/23.
*/
public class CustomerDao
{
private QueryRunner qr=new TxQueryRunner();
public void add(Customer c)
{
try {
String sql = “insert into t_customer values(??????)“;
object[] params = {c.getId() c.getName() c.getGender()
c.getPhone() c.getEmail() c.getDescription()};
qr.update(sql params);
}catch (Exception e)
{
throw new RuntimeException(e);
}
}
// public List findAll()
// {
// try{
// String sql=“select * from t_customer“;
// return qr.query(sqlnew BeanListHandler(Customer.class));
// }catch (Exception e)
// {
// throw new RuntimeException(e);
// }
// }
public PageBean findAll(int pc int pr)
{
try{
/*
*1.他需要创建pageBean对象pb
* 2.设置pb的pc和pr
* 3.得到tr,设置给pb
* 4.得到beanList设置给pb
* 最后返回给pb
*/
PageBean pb=new PageBean<>();
pb.setPc(pc);
pb.setPr(pr);
String sql=“select count(*) from t_customer“;
Number number=(Number) qr.query(sqlnew ScalarHandler<>());
int tr=number.intValue();
pb.setTr(tr);
sql=“select * from t_customer order by name limit ??“;
object[] params={(pc-1)*prpr};
List beanList=qr.query(sqlnew BeanListHandler<>(Customer.class)params);
pb.setBeanList(beanList);
return pb;
}catch (Exception e)
{
throw new RuntimeException(e);
}
}
public Customer find(String id)
{
try {
String sql = “select * from t_customer where id=?“;
return qr.query(sql new BeanHandler(Customer.class) id);
}catch (Exception e)
{
throw new RuntimeException(e);
}
}
public void edit(Customer customer)
{
try{
String sql=“update t_customer set name=?gender=?phone=?email=?description=? where id=?“;
object[] params={customer.getName()customer.getGender()customer.getPhone()customer.getEmail()customer.getDescription()customer.getId()};
qr.update(sqlparams);
}catch (Exception e)
{
throw new RuntimeException(e);
}
}
public void delete
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2017-04-06 07:48 CustomerManagement-master\
文件 1425 2017-04-06 07:48 CustomerManagement-master\CustomerManagement.iml
文件 2148 2017-04-06 07:48 CustomerManagement-master\README.md
目录 0 2017-04-06 07:48 CustomerManagement-master\out\
目录 0 2017-04-06 07:48 CustomerManagement-master\out\artifacts\
目录 0 2017-04-06 07:48 CustomerManagement-master\out\artifacts\CustomerManagement_war_exploded\
目录 0 2017-04-06 07:48 CustomerManagement-master\out\artifacts\CustomerManagement_war_exploded\WEB-INF\
目录 0 2017-04-06 07:48 CustomerManagement-master\out\artifacts\CustomerManagement_war_exploded\WEB-INF\classes\
目录 0 2017-04-06 07:48 CustomerManagement-master\out\artifacts\CustomerManagement_war_exploded\WEB-INF\classes\Demo\
文件 1429 2017-04-06 07:48 CustomerManagement-master\out\artifacts\CustomerManagement_war_exploded\WEB-INF\classes\Demo\Demo.class
文件 578 2017-04-06 07:48 CustomerManagement-master\out\artifacts\CustomerManagement_war_exploded\WEB-INF\classes\c3p0-config.xm
目录 0 2017-04-06 07:48 CustomerManagement-master\out\artifacts\CustomerManagement_war_exploded\WEB-INF\classes\dao\
文件 5251 2017-04-06 07:48 CustomerManagement-master\out\artifacts\CustomerManagement_war_exploded\WEB-INF\classes\dao\CustomerDao.class
目录 0 2017-04-06 07:48 CustomerManagement-master\out\artifacts\CustomerManagement_war_exploded\WEB-INF\classes\domain\
文件 1450 2017-04-06 07:48 CustomerManagement-master\out\artifacts\CustomerManagement_war_exploded\WEB-INF\classes\domain\Customer.class
文件 1919 2017-04-06 07:48 CustomerManagement-master\out\artifacts\CustomerManagement_war_exploded\WEB-INF\classes\domain\PageBean.class
目录 0 2017-04-06 07:48 CustomerManagement-master\out\artifacts\CustomerManagement_war_exploded\WEB-INF\classes\service\
文件 1335 2017-04-06 07:48 CustomerManagement-master\out\artifacts\CustomerManagement_war_exploded\WEB-INF\classes\service\CustomerService.class
目录 0 2017-04-06 07:48 CustomerManagement-master\out\artifacts\CustomerManagement_war_exploded\WEB-INF\classes\servlet\
文件 4661 2017-04-06 07:48 CustomerManagement-master\out\artifacts\CustomerManagement_war_exploded\WEB-INF\classes\servlet\CustomerServlet.class
目录 0 2017-04-06 07:48 CustomerManagement-master\out\artifacts\CustomerManagement_war_exploded\WEB-INF\lib\
文件 497865 2017-04-06 07:48 CustomerManagement-master\out\artifacts\CustomerManagement_war_exploded\WEB-INF\lib\c3p0-0.9.5.2.jar
文件 246174 2017-04-06 07:48 CustomerManagement-master\out\artifacts\CustomerManagement_war_exploded\WEB-INF\lib\commons-beanutils-1.9.3.jar
文件 588337 2017-04-06 07:48 CustomerManagement-master\out\artifacts\CustomerManagement_war_exploded\WEB-INF\lib\commons-collections-3.2.2.jar
文件 77857 2017-04-06 07:48 CustomerManagement-master\out\artifacts\CustomerManagement_war_exploded\WEB-INF\lib\commons-dbutils-1.6.jar
文件 61829 2017-04-06 07:48 CustomerManagement-master\out\artifacts\CustomerManagement_war_exploded\WEB-INF\lib\commons-logging-1.2.jar
文件 25277 2017-04-06 07:48 CustomerManagement-master\out\artifacts\CustomerManagement_war_exploded\WEB-INF\lib\itcast-tools-1.4.jar
文件 414240 2017-04-06 07:48 CustomerManagement-master\out\artifacts\CustomerManagement_war_exploded\WEB-INF\lib\jstl-1.2.jar
文件 606472 2017-04-06 07:48 CustomerManagement-master\out\artifacts\CustomerManagement_war_exploded\WEB-INF\lib\mchange-commons-java-0.2.11.jar
文件 540852 2017-04-06 07:48 CustomerManagement-master\out\artifacts\CustomerManagement_war_exploded\WEB-INF\lib\mysql-connector-java-5.0.8-bin.jar
文件 602 2017-04-06 07:48 CustomerManagement-master\out\artifacts\CustomerManagement_war_exploded\WEB-INF\web.xm
............此处省略57个文件信息
相关资源
- Android应用源码警务通项目+服务端+数
- jsp的网上购物商城
- JspLibrary.zip
- 基于MVC的网上订餐管理系统
- JAVA医药管理系统设计(论文+源代码)
- jsp网上书店
- JSP期末编程题加源程序
- Java serlvet+Jdbc+jsp+mysql 用户权限管理系
- UEditor JSP版的
- jsp+mysql物业管理系统 全部源代码
- 基于Javaweb的酒店订房系统
- jsp网上购物系统源代码
- webservlet水果购物系统.zip
- 校园点餐系统
- jsp物流中心仓储信息管理系统
- JAVA.JSP人力资源管理系统
- jsp药店管理系统
- jsp网络在线订餐网站系统ssh毕业设计
- jsp+servlet人事管理系统
- 基于Javaweb的网上点餐系统 有前台和
- 310JSP校友录
- 图书馆管理系统源码javaweb
- JSP视频点播系统完整源代码Myeclipse打
- 宠物诊所信息管理系统 源代码
- javaweb购物商城-鞋动起来
- eWebEditor V9.5 for JSP 简体中文版(GBK)
- jsp 实现的IP地址查询功能的web应用,
- 基于Servlet+jsp+mysql开发javaWeb学生成绩
- 基于 Servlet+jsp+mysql 开发 javaWeb 学生网
- 基于Servlet+jsp的企业财务管理系统设计
评论
共有 条评论