Java Web实战项目:客户管理管理系统
jsp+jdbc实现客户关系管理系统
15.客户关系管理系统架构的搭建
步骤:
1.导入原型(只有页面,但没有功能的一个项目,功能都是直接跳转).
2.功能分析:
- 添加客户
- 查询所有客户
- 编辑客户:(加载这个客户到表单中显示)(修改客户)
- 删除客户
- 多条件组合查询
3.创建数据
create database if not exists customers;
use customer;
create table t_customers(
cid CHAR(32) PRIMARY KEY,
cname VARCHAR(40) NOT NULL,
birthday CHAR(10),
cellphone VARCHAR(15) NOT NULL,
email VARCHAR(40),
descripation VARCHAR(500)
);
SELECT * from t_customers;
4.创建包:公司名,项目名,分层
----->com.tinstu.domain :Customer,它与表单和t_customer表对应
----->com.tinstu.dao :CustomerDao
----->com.tinstu.service : CustomerService , 它没有业务,其实它不存在也可以
----->com.tinstu.web.servlet : CustomerServlet
5.导包 :
- MySQL驱动
- c9p0(两个,一个配置文件)
- dbutils
- 自己的工具 jdbcUtils , 他在itcast-tools.jar
- bentuils logging
2.添加客户
add.jsp -------> CustomerService#add( ) ----> 显示添加成功!
查询客户
- top.jsp(查询客户) CustomerServlet#findAll( ) ---> list.jsp ( 循环显示 )
删除客户
- list.jsp(删除链接)---> CustomerServlet( ) -->msg.jsp
插入查询所用的测试数据
package com.tinstu.units;
import org.junit.Test;
import com.tinstu.dao.CustomerDao;
import com.tinstu.domain.Customer;
import cn.itcast.commons.CommonUtils;
public class CustomerText {
@Test
public void fun1() {
CustomerDao d = new CustomerDao();
for(int i=1;i<300;i++) {
Customer c =new Customer();
c.setCid(CommonUtils.uuid());
c.setCname(i+"号客户");
c.setGender(i%2==0?"男":"女");
c.setBirthday("2000-11-1");
c.setCellphone("159"+i);
c.setEmail(i+"@qq.com");
c.setDescription("我是"+i+"号客户.");
d.add(c);
}
}
}
多条件组合查询
阅读剩余
版权声明:
作者:Tin
链接:http://www.tinstu.com/903.html
文章版权归作者所有,未经允许请勿转载。
THE END