一、后端servlet开发

1.1、创建Custom实体类

public class Custom {private  int id;private String name;private int age;private int  Sex;private String phone;private String wechat;private String addr;private String hoby;private String email;private String occupation;private  int uid;public int getId() {return id;}public void setId(int id) {this.id = id;}public String getName() {return name;}public void setName(String name) {this.name = name;}public int getAge() {return age;}public void setAge(int age) {this.age = age;}public int getSex() {return Sex;}public void setSex(int sex) {Sex = sex;}public String getPhone() {return phone;}public void setPhone(String phone) {this.phone = phone;}public String getWechat() {return wechat;}public void setWechat(String wechat) {this.wechat = wechat;}public String getAddr() {return addr;}public void setAddr(String addr) {this.addr = addr;}public String getHoby() {return hoby;}public void setHoby(String hoby) {this.hoby = hoby;}public String getEmail() {return email;}public void setEmail(String email) {this.email = email;}public String getOccupation() {return occupation;}public void setOccupation(String occupation) {this.occupation = occupation;}public int getUid() {return uid;}public void setUid(int uid) {this.uid = uid;}
}

1.2、创建CustomDAO,新增用户的方法

public class CustomDAOImpl extends BaseDAO implements CustomDAO {public int insertCustom(Custom custom) {String sql = "insert into t_custom (name,age,sex,phone,wechat,addr,hoby,email,occupation,uid) values ('"+custom.getName()+"',"+custom.getAge()+","+custom.getSex()+",'"+custom.getPhone()+"','"+custom.getWechat()+"','"+custom.getAddr()+"','"+custom.getHoby()+"','"+custom.getEmail()+"', '"+custom.getOccupation()+"',"+custom.getUid()+")";        int count = this.executeUpdate(sql);return count;}
}

1.3、创建CustomAddServlet

第1步:在session中获取用户id

//从session中获取用户的id
HttpSession session = req.getSession();
Manger manger =(Manger) session.getAttribute("user");int uid=manger.getId();

第2步:将用户信息通过dao保存到数据库

 CustomDAO dao=new CustomDAOImpl();//获取请求传参String name = req.getParameter("name");int age = Integer.parseInt(req.getParameter("age"));int sex = Integer.parseInt(req.getParameter("sex"));String phone = req.getParameter("phone");String wechat = req.getParameter("wechat");String addr = req.getParameter("addr");String hoby = req.getParameter("hoby");String email = req.getParameter("email");String occupation = req.getParameter("occupation");Custom custom = new Custom();custom.setName(name);custom.setAge(age);custom.setSex(sex);custom.setPhone(phone);custom.setWechat(wechat);custom.setAddr(addr);custom.setHoby(hoby);custom.setEmail(email);custom.setOccupation(occupation);custom.setUid(uid);int count = dao.insertCustom(custom);if(count>0){writer.print("保存成功");}else{writer.print("保存失败");}writer.close();//释放资源
}

二、前端HTML开发

2.1、通过vue的双向绑定收集用户信息

data:{customName: null,age: null,sex: null,phone: null,wechat: null,addr: null,hoby: null,email: null,occupation: null
},

2.2、给添加按钮绑定点击事件

<button class="btn btn-primary" style="margin-right: 8px;" @click="doAdd()">添加</button>

2.3、通过axios发送请求访问servlet添加客户

doAdd(){var url = "http://localhost:8080/custom_add?name="+this.customName+"&age="+this.age+"&sex="+this.sex+"&phone="+this.phone+"&wechat="+this.wechat+"&addr="+this.addr+"&hoby="+this.hoby+"&email="+this.email+"&occupation="+this.occupation;console.log(url);axios.get(url).then(response=>{if(response.data=="保存成功"){alert("自己查数据库");//window.location.href="user_list.html"}else{alert('添加失败!!!');}})
},

CRM管理系统添加客户相关推荐

  1. 制作CRM管理系统04(客户增加)

    一.后端servlet开发 1.1.创建Custom实体类 package entity;public class Custom {private int id;private String name ...

  2. 制作CRM管理系统05(客户管理)

    目录 一.后台servlet开发 1.1.在CustomDAO中添加查询所有客户的方法 1.2.添加CustomAddServlet 二.前端html开发 2.1.在created方法中通过axios ...

  3. CRM管理系统查询客户信息

    一.后台servlet开发 1.1.在CustomDAO中添加查询所有客户的方法 public List<Custom> selectAllCustoms() {String sql=&q ...

  4. ThinkPHP和uniapp开发的CRM售后管理系统(客户、合同、工单、任务、报价、产品、库存、出纳、收费)

    ThinkPHP和uniapp开发的CRM售后管理系统无加密的开源源码(可用于自营+外包项目(多主体).可用于外包定制开发项目) 主要功能:客户.合同.工单.任务.报价.产品.库存.出纳.收费, 适用 ...

  5. CRM管理系统、教育后台、赠品管理、优惠管理、预约管理、试听课、教师、学生、客户、学员、商品管理、科目、优惠券、完课回访、客户管理系统、收费、退费、回访、账号权限、订单流水、审批、转账、rp原型

    CRM管理系统.教育后台.赠品管理.优惠管理.预约管理.试听课.教师.学生.客户.学员.商品管理.科目.优惠券.完课回访.客户管理系统.收费.退费.回访.账号权限.订单流水.Axure原型.rp原型 ...

  6. SSH与SSM学习之SSH实现CRM练习17——添加客户拜访记录和列表

    SSH与SSM学习之SSH实现CRM练习17添加客户拜访记录和列表 一添加客户拜访记录和列表演示 1 添加客户拜访记录演示 2 客户拜访记录列表演示 二添加客户拜访记录分析 三添加客户拜访记录表实体关 ...

  7. 2023最新PHP客户关系CRM管理系统源码+企业CRM管理系统源码

    正文: PHP客户关系CRM管理系统源码 企业crm管理系统PHP源码下载 系统功能 1. 公海管理:公海类型.客户公海. 2. 线索管理:我的线索.线索列表.线索状态.线索来源. 3. 客户管理:我 ...

  8. 外贸业务管理系统,外贸CRM管理系统,外贸客户管理软件CRM排名

    随着全球化的发展和国际贸易的繁荣,外贸企业越来越重视客户关系管理(CRM)的重要性.外贸CRM管理系统成为帮助企业提升客户管理效率和业务发展的利器.本文将介绍外贸业务管理系统和外贸CRM管理系统的概念 ...

  9. CRM 基于SSM+ 客户管理系统 (商品销售管理)

    第一节了解整个软件开发周期 提示:写完文章后,目录可以自动生成,如何生成可参考右边的帮助文档 文章目录 系列文章目录 前言 一.pandas是什么? 二.使用步骤 1.引入库 2.读入数据 总结 一. ...

最新文章

  1. 3dmax Vray建筑可视化入门学习教程
  2. Python的输入指令、格式化输出、基本运算符
  3. 新手如何使用有三AI系统性跟读AI领域的论文
  4. vc2010访问局域网mysql_VC2010利用MySQL++访问mysql. 及连接池示例
  5. layui2.4.0前的table隐藏列
  6. PBS_HAS_CHANGED ~ GET_SAP_MENU_INFO
  7. php curl http2,用php做ios http2推送服务遇到的坑
  8. Android官方开发文档Training系列课程中文版:布局性能优化之按需加载View
  9. excel 多次筛选后的range数据处理
  10. MyBatis入门让它跑起来
  11. 一本名不符实的.NET书籍: Game Engine Toolset Development
  12. 华为发布全新一代OceanStor存储Pacific系列,打造海量数据存储新标杆
  13. “机智号”成功试飞火星,但它使用的开源软件安全吗?
  14. access mysql 升迁_随说秋色园从Access升迁到MSSQL过程
  15. windows server 2000系统安装
  16. arduino中利用LiquidCrystal内置的scrool函数实现屏幕文字滚动播放
  17. 局域网计算机名和ip扫描工具,局域网IP扫描器(Advanced IP Scanner)
  18. 快慢指针解决回文问题
  19. bzoj 1984: 月下“毛景树”
  20. 要开始写日志了(Live Witer)

热门文章

  1. usb转com口驱动
  2. 【信管1.6】计算机网络基础(四)网络规划与数据软件
  3. ChatGPT是什么?可以用来做什么?
  4. Java-名片管理系统
  5. Permission denied: user=dr.who, access=READ_EXECUTE, inode=/user/root:root:supergroup:drwx------
  6. Org-mode + GitHub 搭建自己的云笔记
  7. Microsoft公司 .CAB文件格式
  8. 异常检测---离群点
  9. 超详细Docker部署SpringBoot+Vue项目(三更博客项目部署)
  10. jupyter notebook 基本操作