├── .classpath ├── .mymetadata ├── .project ├── .settings ├── .jsdtscope ├── org.eclipse.core.resources.prefs ├── org.eclipse.jdt.core.prefs ├── org.eclipse.wst.common.component ├── org.eclipse.wst.common.project.facet.core.xml ├── org.eclipse.wst.jsdt.ui.superType.container └── org.eclipse.wst.jsdt.ui.superType.name ├── WebRoot ├── META-INF │ └── MANIFEST.MF ├── SQLFile │ └── shop.sql ├── WEB-INF │ ├── classes │ │ ├── mybean │ │ │ └── data │ │ │ │ ├── DataByPage.class │ │ │ │ ├── Login.class │ │ │ │ └── Register.class │ │ └── myservlet │ │ │ └── control │ │ │ ├── HandleBuyGoods.class │ │ │ ├── HandleDelete.class │ │ │ ├── HandleExit.class │ │ │ ├── HandleLogin.class │ │ │ ├── HandleRegister.class │ │ │ ├── PutGoodsToCar.class │ │ │ ├── QueryAllRecord.class │ │ │ └── SearchByCondition.class │ ├── lib │ │ └── mysql-connector-java-5.0.8-bin.jar │ └── web.xml ├── byPageShow.jsp ├── head.jsp ├── image │ ├── back.jpg │ ├── est1.jpg │ ├── lan1.jpg │ ├── lan2.jpg │ ├── login_back.jpg │ └── welcome.jpg ├── index.jsp ├── inputRegisterMess.jsp ├── login.jsp ├── lookCosmetic.jsp ├── lookOrderForm.jsp ├── lookShoppingCar.jsp ├── searchCosmetic.jsp └── showDetail.jsp └── src ├── mybean └── data │ ├── DataByPage.java │ ├── Login.java │ └── Register.java └── myservlet └── control ├── HandleBuyGoods.java ├── HandleDelete.java ├── HandleExit.java ├── HandleLogin.java ├── HandleRegister.java ├── PutGoodsToCar.java ├── QueryAllRecord.java └── SearchByCondition.java /.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.mymetadata: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | CosmeticsSales 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.wst.common.project.facet.core.builder 10 | 11 | 12 | 13 | 14 | org.eclipse.wst.jsdt.core.javascriptValidator 15 | 16 | 17 | 18 | 19 | com.genuitec.eclipse.j2eedt.core.WebClasspathBuilder 20 | 21 | 22 | 23 | 24 | org.eclipse.jdt.core.javabuilder 25 | 26 | 27 | 28 | 29 | com.genuitec.eclipse.j2eedt.core.J2EEProjectValidator 30 | 31 | 32 | 33 | 34 | com.genuitec.eclipse.j2eedt.core.DeploymentDescriptorValidator 35 | 36 | 37 | 38 | 39 | org.eclipse.wst.validation.validationbuilder 40 | 41 | 42 | 43 | 44 | com.genuitec.eclipse.ast.deploy.core.DeploymentBuilder 45 | 46 | 47 | 48 | 49 | 50 | com.genuitec.eclipse.ast.deploy.core.deploymentnature 51 | org.eclipse.jem.workbench.JavaEMFNature 52 | com.genuitec.eclipse.j2eedt.core.webnature 53 | org.eclipse.jdt.core.javanature 54 | org.eclipse.wst.jsdt.core.jsNature 55 | org.eclipse.wst.common.project.facet.core.nature 56 | org.eclipse.wst.common.modulecore.ModuleCoreNature 57 | 58 | 59 | -------------------------------------------------------------------------------- /.settings/.jsdtscope: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding//WebRoot/inputRegisterMess.jsp=UTF-8 3 | -------------------------------------------------------------------------------- /.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 4 | org.eclipse.jdt.core.compiler.compliance=1.5 5 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 6 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 7 | org.eclipse.jdt.core.compiler.source=1.5 8 | -------------------------------------------------------------------------------- /.settings/org.eclipse.wst.common.component: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.settings/org.eclipse.wst.common.project.facet.core.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.settings/org.eclipse.wst.jsdt.ui.superType.container: -------------------------------------------------------------------------------- 1 | org.eclipse.wst.jsdt.launching.baseBrowserLibrary -------------------------------------------------------------------------------- /.settings/org.eclipse.wst.jsdt.ui.superType.name: -------------------------------------------------------------------------------- 1 | Window -------------------------------------------------------------------------------- /WebRoot/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Class-Path: 3 | 4 | -------------------------------------------------------------------------------- /WebRoot/SQLFile/shop.sql: -------------------------------------------------------------------------------- 1 | /* 2 | Navicat MySQL Data Transfer 3 | 4 | Source Server : 201810620306丁培良 5 | Source Server Version : 50527 6 | Source Host : localhost:3306 7 | Source Database : shop 8 | 9 | Target Server Type : MYSQL 10 | Target Server Version : 50527 11 | File Encoding : 65001 12 | 13 | Date: 2019-01-19 16:06:14 14 | */ 15 | 16 | SET FOREIGN_KEY_CHECKS=0; 17 | 18 | -- ---------------------------- 19 | -- Table structure for classify 20 | -- ---------------------------- 21 | DROP TABLE IF EXISTS `classify`; 22 | CREATE TABLE `classify` ( 23 | `id` int(11) NOT NULL AUTO_INCREMENT, 24 | `name` char(200) NOT NULL, 25 | PRIMARY KEY (`id`) 26 | ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8; 27 | 28 | -- ---------------------------- 29 | -- Records of classify 30 | -- ---------------------------- 31 | INSERT INTO `classify` VALUES ('1', '兰蔻'); 32 | INSERT INTO `classify` VALUES ('2', '娇兰'); 33 | INSERT INTO `classify` VALUES ('3', '雅诗兰黛'); 34 | 35 | -- ---------------------------- 36 | -- Table structure for cosmeticform 37 | -- ---------------------------- 38 | DROP TABLE IF EXISTS `cosmeticform`; 39 | CREATE TABLE `cosmeticform` ( 40 | `cosmetic_number` char(255) NOT NULL, 41 | `cosmetic_name` char(255) DEFAULT NULL, 42 | `cosmetic_made` char(255) DEFAULT NULL, 43 | `cosmetic_price` float DEFAULT NULL, 44 | `cosmetic_mess` char(255) DEFAULT NULL, 45 | `cosmetic_pic` char(255) NOT NULL, 46 | `id` int(11) DEFAULT NULL, 47 | PRIMARY KEY (`cosmetic_number`,`cosmetic_pic`), 48 | KEY `id` (`id`), 49 | CONSTRAINT `id` FOREIGN KEY (`id`) REFERENCES `classify` (`id`) 50 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 51 | 52 | -- ---------------------------- 53 | -- Records of cosmeticform 54 | -- ---------------------------- 55 | INSERT INTO `cosmeticform` VALUES ('EsteeLauder1001', '雅诗兰黛眼霜', 'EsteeLauder', '389', '功效:去黑眼圈', 'est1.jpg', '3'); 56 | INSERT INTO `cosmeticform` VALUES ('lan_a10002', '兰蔻乳液', '法国Lancome', '588', '乳液功效:补水 保湿', 'lan2.jpg', '1'); 57 | INSERT INTO `cosmeticform` VALUES ('lan_a1001', '兰蔻清莹柔肤水', '法国Lancome', '229', '化妆品净含量:400g', 'lan1.jpg', '1'); 58 | 59 | -- ---------------------------- 60 | -- Table structure for orderform 61 | -- ---------------------------- 62 | DROP TABLE IF EXISTS `orderform`; 63 | CREATE TABLE `orderform` ( 64 | `id` int(10) NOT NULL AUTO_INCREMENT, 65 | `logname` char(255) DEFAULT NULL, 66 | `mess` char(255) DEFAULT NULL, 67 | `sum` float DEFAULT NULL, 68 | PRIMARY KEY (`id`) 69 | ) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8; 70 | 71 | -- ---------------------------- 72 | -- Records of orderform 73 | -- ---------------------------- 74 | INSERT INTO `orderform` VALUES ('1', 'dpl', '1:(lan_a10002,兰蔻乳液,法国Lancome,588.0)2:(lan_a10002,兰蔻乳液,法国Lancome,588.0)', '1176'); 75 | INSERT INTO `orderform` VALUES ('2', 'dpl', '1:(lan_a10002,兰蔻乳液,法国Lancome,588.0)', '588'); 76 | INSERT INTO `orderform` VALUES ('3', 'dpl', '1:(lan_a10002,兰蔻乳液,法国Lancome,588.0)', '588'); 77 | INSERT INTO `orderform` VALUES ('4', 'dpl', '1:(EsteeLauder1001,雅诗兰黛眼霜,EsteeLauder,389)', '389'); 78 | INSERT INTO `orderform` VALUES ('5', 'dpl', '1:(EsteeLauder1001,雅诗兰黛眼霜,EsteeLauder,389.0)', '389'); 79 | INSERT INTO `orderform` VALUES ('6', 'dpl', '1:(lan_a10002,兰蔻乳液,法国Lancome,588)', '588'); 80 | 81 | -- ---------------------------- 82 | -- Table structure for user 83 | -- ---------------------------- 84 | DROP TABLE IF EXISTS `user`; 85 | CREATE TABLE `user` ( 86 | `logname` char(255) NOT NULL, 87 | `password` char(255) DEFAULT NULL, 88 | `phone` char(255) DEFAULT NULL, 89 | `address` char(255) DEFAULT NULL, 90 | `realname` char(255) DEFAULT NULL COMMENT '存储姓名', 91 | PRIMARY KEY (`logname`) 92 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 93 | 94 | -- ---------------------------- 95 | -- Records of user 96 | -- ---------------------------- 97 | INSERT INTO `user` VALUES ('ddddd', '123456789', '17895264876', '山东滨州', '颠沛流离'); 98 | INSERT INTO `user` VALUES ('dpl', '123456', '17862078760', '山东滨州', '小丁'); 99 | INSERT INTO `user` VALUES ('dpl12', '123456', '17862028760', '山东滨州', '打破了'); 100 | INSERT INTO `user` VALUES ('dpl123', '123456', '17862078760', '山东滨州', '丁丁'); 101 | INSERT INTO `user` VALUES ('dpll19', '12345', '17862078759', '山东济南', '小布丁'); 102 | INSERT INTO `user` VALUES ('dpppp', '123456', '17862028760', '山东滨州', '打破了'); 103 | -------------------------------------------------------------------------------- /WebRoot/WEB-INF/classes/mybean/data/DataByPage.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dpl12/CosmeticsSales/04d89f0993573e73023f46087c7c5967d6cf9d30/WebRoot/WEB-INF/classes/mybean/data/DataByPage.class -------------------------------------------------------------------------------- /WebRoot/WEB-INF/classes/mybean/data/Login.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dpl12/CosmeticsSales/04d89f0993573e73023f46087c7c5967d6cf9d30/WebRoot/WEB-INF/classes/mybean/data/Login.class -------------------------------------------------------------------------------- /WebRoot/WEB-INF/classes/mybean/data/Register.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dpl12/CosmeticsSales/04d89f0993573e73023f46087c7c5967d6cf9d30/WebRoot/WEB-INF/classes/mybean/data/Register.class -------------------------------------------------------------------------------- /WebRoot/WEB-INF/classes/myservlet/control/HandleBuyGoods.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dpl12/CosmeticsSales/04d89f0993573e73023f46087c7c5967d6cf9d30/WebRoot/WEB-INF/classes/myservlet/control/HandleBuyGoods.class -------------------------------------------------------------------------------- /WebRoot/WEB-INF/classes/myservlet/control/HandleDelete.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dpl12/CosmeticsSales/04d89f0993573e73023f46087c7c5967d6cf9d30/WebRoot/WEB-INF/classes/myservlet/control/HandleDelete.class -------------------------------------------------------------------------------- /WebRoot/WEB-INF/classes/myservlet/control/HandleExit.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dpl12/CosmeticsSales/04d89f0993573e73023f46087c7c5967d6cf9d30/WebRoot/WEB-INF/classes/myservlet/control/HandleExit.class -------------------------------------------------------------------------------- /WebRoot/WEB-INF/classes/myservlet/control/HandleLogin.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dpl12/CosmeticsSales/04d89f0993573e73023f46087c7c5967d6cf9d30/WebRoot/WEB-INF/classes/myservlet/control/HandleLogin.class -------------------------------------------------------------------------------- /WebRoot/WEB-INF/classes/myservlet/control/HandleRegister.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dpl12/CosmeticsSales/04d89f0993573e73023f46087c7c5967d6cf9d30/WebRoot/WEB-INF/classes/myservlet/control/HandleRegister.class -------------------------------------------------------------------------------- /WebRoot/WEB-INF/classes/myservlet/control/PutGoodsToCar.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dpl12/CosmeticsSales/04d89f0993573e73023f46087c7c5967d6cf9d30/WebRoot/WEB-INF/classes/myservlet/control/PutGoodsToCar.class -------------------------------------------------------------------------------- /WebRoot/WEB-INF/classes/myservlet/control/QueryAllRecord.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dpl12/CosmeticsSales/04d89f0993573e73023f46087c7c5967d6cf9d30/WebRoot/WEB-INF/classes/myservlet/control/QueryAllRecord.class -------------------------------------------------------------------------------- /WebRoot/WEB-INF/classes/myservlet/control/SearchByCondition.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dpl12/CosmeticsSales/04d89f0993573e73023f46087c7c5967d6cf9d30/WebRoot/WEB-INF/classes/myservlet/control/SearchByCondition.class -------------------------------------------------------------------------------- /WebRoot/WEB-INF/lib/mysql-connector-java-5.0.8-bin.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dpl12/CosmeticsSales/04d89f0993573e73023f46087c7c5967d6cf9d30/WebRoot/WEB-INF/lib/mysql-connector-java-5.0.8-bin.jar -------------------------------------------------------------------------------- /WebRoot/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | registerServlet 10 | myservlet.control.HandleRegister 11 | 12 | 13 | loginServlet 14 | myservlet.control.HandleLogin 15 | 16 | 17 | deleteServlet 18 | myservlet.control.HandleDelete 19 | 20 | 21 | buyServlet 22 | myservlet.control.HandleBuyGoods 23 | 24 | 25 | queryServlet 26 | myservlet.control.QueryAllRecord 27 | 28 | 29 | putGoodsServlet 30 | myservlet.control.PutGoodsToCar 31 | 32 | 33 | searchByConditionServlet 34 | myservlet.control.SearchByCondition 35 | 36 | 37 | exitServlet 38 | myservlet.control.HandleExit 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | registerServlet 49 | /registerServlet 50 | 51 | 52 | loginServlet 53 | /loginServlet 54 | 55 | 56 | deleteServlet 57 | /deleteServlet 58 | 59 | 60 | buyServlet 61 | /buyServlet 62 | 63 | 64 | queryServlet 65 | /queryServlet 66 | 67 | 68 | putGoodsServlet 69 | /putGoodsServlet 70 | 71 | 72 | searchByConditionServlet 73 | /searchByConditionServlet 74 | 75 | 76 | exitServlet 77 | /exitServlet 78 | 79 | 80 | index.jsp 81 | 82 | 83 | -------------------------------------------------------------------------------- /WebRoot/byPageShow.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> 2 | <%@ page import="mybean.data.DataByPage" %> 3 | <%@ page import="com.sun.rowset.*" %> 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |
当前显示的内容是: 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | <% 28 | CachedRowSetImpl rowSet=dataBean.getRowSet(); 29 | if(rowSet==null){ 30 | out.print("没有任何查询信息,无法浏览"); 31 | return; 32 | } 33 | rowSet.last(); //最后一行 34 | int totalRecord=rowSet.getRow();//获取总记录数 35 | out.println("全部记录数"+totalRecord); 36 | int pageSize=dataBean.getPageSize();//每页显示的记录数 37 | int totalPages=dataBean.getTotalPages();//获取分页后的总页数 38 | if(totalRecord%pageSize==0){ 39 | totalPages=totalRecord/pageSize;//总页数 40 | }else{ 41 | totalPages=totalRecord/pageSize+1; 42 | } 43 | dataBean.setPageSize(pageSize); 44 | dataBean.setTotalPages(totalPages); 45 | if(totalPages>=1){ 46 | if(dataBean.getCurrentPage()<1) 47 | dataBean.setCurrentPage(dataBean.getTotalPages()); 48 | if(dataBean.getCurrentPage()>dataBean.getTotalPages()) 49 | dataBean.setCurrentPage(1); 50 | int index=(dataBean.getCurrentPage()-1)*pageSize+1; 51 | rowSet.absolute(index);//查询位置移动到currentPage页起始位置 52 | boolean boo=true; 53 | for(int i=1;i<=pageSize&&boo;i++){ 54 | String number=rowSet.getString(1); 55 | String name=rowSet.getString(2); 56 | String maker=rowSet.getString(3); 57 | String price=rowSet.getString(4); 58 | String goods="("+number+","+name+","+maker+","+price+")#"+price;//便于购物车计算价格,尾缀上“#”价格值 59 | goods=goods.replaceAll("\\p{Blank}",""); 60 | String button="
"+ 61 | ""+ //隐藏hidden,提交时直接将其value的值提交 62 | ""; 63 | String detail="
"+ 64 | ""+ 65 | "" ; 66 | out.print("
"); 67 | out.print(""); 68 | out.print(""); 69 | out.print(""); 70 | out.print(""); 71 | out.print(""); 72 | out.print(""); 73 | out.print(""); 74 | boo=rowSet.next(); 75 | } 76 | } 77 | %> 78 |
化妆品标识号化妆品名称化妆品制造商化妆品价格查看详情添加到购物车
"+number+""+name+""+maker+""+price+""+detail+""+button+"
79 |
每页最多显示条信息 80 |
当前显示第 81 | 82 | 页,共有 83 | 84 | 85 | 页。 86 | 87 | 88 | 94 | 100 | 101 | 102 | 108 | 114 | 115 |
89 |
90 | 91 | 92 |
93 |
95 |
96 | 97 | 98 |
99 |
103 |
104 | 每页显示 105 | 条记录 106 |
107 |
109 |
110 | 输入页码: 111 | 112 |
113 |
116 |
117 |
118 | 119 | 120 | -------------------------------------------------------------------------------- /WebRoot/head.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> 2 | 3 | 4 | 5 |
6 |

"青山绿水"化妆品销售网

7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
主页浏览化妆品查询化妆品查看购物车查看订单登录注册退出
19 |
20 |


21 | 22 | 23 | -------------------------------------------------------------------------------- /WebRoot/image/back.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dpl12/CosmeticsSales/04d89f0993573e73023f46087c7c5967d6cf9d30/WebRoot/image/back.jpg -------------------------------------------------------------------------------- /WebRoot/image/est1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dpl12/CosmeticsSales/04d89f0993573e73023f46087c7c5967d6cf9d30/WebRoot/image/est1.jpg -------------------------------------------------------------------------------- /WebRoot/image/lan1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dpl12/CosmeticsSales/04d89f0993573e73023f46087c7c5967d6cf9d30/WebRoot/image/lan1.jpg -------------------------------------------------------------------------------- /WebRoot/image/lan2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dpl12/CosmeticsSales/04d89f0993573e73023f46087c7c5967d6cf9d30/WebRoot/image/lan2.jpg -------------------------------------------------------------------------------- /WebRoot/image/login_back.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dpl12/CosmeticsSales/04d89f0993573e73023f46087c7c5967d6cf9d30/WebRoot/image/login_back.jpg -------------------------------------------------------------------------------- /WebRoot/image/welcome.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dpl12/CosmeticsSales/04d89f0993573e73023f46087c7c5967d6cf9d30/WebRoot/image/welcome.jpg -------------------------------------------------------------------------------- /WebRoot/index.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> 2 | 3 | 4 | 5 | 6 | 首页 7 |
8 |

9 | 欢迎光临"青山绿水"化妆品销售网 10 |

11 | 12 |
13 | 14 | 15 | -------------------------------------------------------------------------------- /WebRoot/inputRegisterMess.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> 2 | 3 | 4 | 5 | 6 | 7 | 注册页面 8 | 9 | 10 | 11 | 12 |
13 |
14 | 15 | 用户名由字母、数字、下划线组成,*注释的选项必须填写。 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 |
*用户名称:*用户密码:
*重复密码:联系电话:
邮寄地址:真实姓名:
31 |
32 |
33 |
34 |

注册反馈: 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 |
会员名称:
姓名:
地址:
电话:
50 |

51 |
52 | 53 | 54 | -------------------------------------------------------------------------------- /WebRoot/login.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
登录
账号:
密码:
19 |
20 |
21 | 登录信息反馈: 22 |
账号: 23 |
24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /WebRoot/lookCosmetic.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> 2 | <%@ page import="java.sql.*" %> 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | <% 14 | try{ 15 | Class.forName("com.mysql.jdbc.Driver"); 16 | }catch(Exception e){} 17 | String uri="jdbc:mysql://127.0.0.1/shop?"+"user=root&password=dpl1215&characterEncoding=utf-8"; 18 | Connection con; 19 | Statement sql; 20 | ResultSet rs; 21 | try{ 22 | con=DriverManager.getConnection(uri); 23 | sql=con.createStatement(); 24 | rs=sql.executeQuery("select * from classify");//获取分类 25 | out.print("
"); 26 | out.print("
"); 33 | con.close(); 34 | }catch(Exception e){ 35 | out.print(e); 36 | } 37 | %> 38 |
39 |
40 | 41 | 42 | -------------------------------------------------------------------------------- /WebRoot/lookOrderForm.jsp: -------------------------------------------------------------------------------- 1 | <%@page import="java.sql.DriverManager"%> 2 | <%@page import="java.sql.ResultSet"%> 3 | <%@page import="java.sql.Statement"%> 4 | <%@page import="java.sql.Connection"%> 5 | <%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | <% 16 | if(loginBean==null){ 17 | response.sendRedirect("login.jsp");//没登录时跳转到登录页面 18 | }else{ 19 | boolean b=loginBean.getLogname()==null||loginBean.getLogname().length()==0; 20 | if(b) 21 | response.sendRedirect("login.jsp"); 22 | } 23 | Connection con; 24 | Statement sql; 25 | ResultSet rs; 26 | try{ 27 | Class.forName("com.mysql.jdbc.Driver"); 28 | }catch(Exception e){} 29 | try{ 30 | String uri="jdbc:mysql://127.0.0.1/shop"; 31 | String user="root"; 32 | String password="dpl1215"; 33 | con=DriverManager.getConnection(uri, user, password); 34 | sql=con.createStatement(); 35 | String cdn="select id,mess,sum from orderForm where logname='"+loginBean.getLogname()+"'"; 36 | rs=sql.executeQuery(cdn); 37 | out.print(""); 38 | out.print(""); 39 | out.print(""); 43 | while(rs.next()){ 44 | out.print(""); 45 | out.print(""); 46 | out.print(""); 47 | out.print(""); 48 | out.print(""); 49 | } 50 | out.print("
"+"订单号"); 40 | out.print(""+"信息"); 41 | out.print(""+"价格"); 42 | out.print("
"+rs.getString(1)+""+rs.getString(2)+""+rs.getString(3)+"
"); 51 | con.close(); 52 | }catch(Exception e){ 53 | out.print(e); 54 | } 55 | %> 56 |
57 | 58 | 59 | -------------------------------------------------------------------------------- /WebRoot/lookShoppingCar.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | <% 13 | if(loginBean==null){ 14 | response.sendRedirect("login.jsp");//重定向到登录页面 15 | }else{ 16 | boolean b=loginBean.getLogname()==null||loginBean.getLogname().length()==0; 17 | if(b) 18 | response.sendRedirect("login.jsp"); 19 | } 20 | LinkedList car=loginBean.getCar(); 21 | if(car==null) 22 | out.print("

购物车没有物品

"); 23 | else{ 24 | Iterator iterator=car.iterator(); 25 | StringBuffer buyGoods=new StringBuffer(); 26 | int n=0; 27 | double priceSum=0; 28 | out.print("购物车中的物品:"); 29 | while(iterator.hasNext()){ 30 | String goods=iterator.next(); 31 | String showGoods=""; 32 | n++; 33 | //购物车物品的后缀是“#价格数字“,比如"化妆品价格3989 #3989" 34 | int index=goods.lastIndexOf("#"); 35 | if(index!=-1){ 36 | priceSum+=Double.parseDouble(goods.substring(index+1)); 37 | showGoods=goods.substring(0,index); 38 | } 39 | buyGoods.append(n+":"+showGoods); 40 | String del=""+ 41 | ""+ 42 | ""; 43 | out.print(""); 44 | out.print(""); 45 | } 46 | out.print("
"+showGoods+""+del+"
"); 47 | String orderForm="
"+ 48 | ""+ 49 | ""+ 50 | "
"; 51 | out.print(orderForm); 52 | } 53 | %> 54 |
55 |
56 | 57 | 58 | -------------------------------------------------------------------------------- /WebRoot/searchCosmetic.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 |
查询时可以输入化妆品的版本号或化妆品名称及价格。
14 | 化妆品名称支持模糊查询。 15 |
输入价格是在2个值之间的价格,格式是:价格1-价格2
16 | 例如258-689 17 |
18 |
输入查询信息:
19 | 化妆品版本号 20 | 化妆品名称 21 | 化妆品价格 22 |
23 |
24 |
25 |
26 | 27 | 28 | -------------------------------------------------------------------------------- /WebRoot/showDetail.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> 2 | <%@ page import="java.sql.*" %> 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | <% 12 | if(loginBean==null){ 13 | response.sendRedirect("login.jsp");//重定向到登录页面 14 | }else{ 15 | boolean b=loginBean.getLogname()==null||loginBean.getLogname().length()==0; 16 | if(b) 17 | response.sendRedirect("login.jsp"); 18 | } 19 | String numberID=request.getParameter("xijie"); 20 | out.print("产品号"+numberID); 21 | if(numberID==null){ 22 | out.print("没有产品号,无法查看细节!"); 23 | return; 24 | } 25 | Connection con; 26 | Statement sql; 27 | ResultSet rs; 28 | try{ 29 | Class.forName("com.mysql.jdbc.Driver"); 30 | }catch(Exception e){} 31 | String uri="jdbc:mysql://127.0.0.1/shop"; 32 | try{ 33 | con=DriverManager.getConnection(uri, "root", "dpl1215"); 34 | sql=con.createStatement(); 35 | rs=sql.executeQuery("select * from cosmeticForm where cosmetic_number='"+numberID+"'"); 36 | out.print(""); 37 | out.print(""); 38 | out.print(""); 44 | String picture="welcome.jpg"; 45 | String detailMess=""; //产品详情 46 | while(rs.next()){ 47 | String number=rs.getString(1); 48 | String name=rs.getString(2); 49 | String maker=rs.getString(3); 50 | String price=rs.getString(4); 51 | detailMess=rs.getString(5); 52 | picture=rs.getString(6); 53 | //便于购物车计算价格,尾缀上"#价格值" 54 | String goods="("+number+","+name+","+maker+","+price+")#"+price; 55 | goods=goods.replaceAll("\\p{Blank}", "");//用""代替空格或制表符(\\p{Blank}) 56 | String button=""+ 57 | ""+ 58 | ""; 59 | out.print(""); 60 | out.print(""); 61 | out.print(""); 62 | out.print(""); 63 | out.print(""); 64 | out.print(""); 65 | out.print(""); 66 | } 67 | out.print("
产品号"); 39 | out.print("名称"); 40 | out.print("制造商"); 41 | out.print("价格"); 42 | out.print("放入购物车"); 43 | out.print("
"+number+""+name+""+maker+""+price+""+button+"
"); 68 | out.print("
产品详情:
"); 69 | out.println("
"+detailMess+"

"); 70 | String pic=""; 71 | out.print(pic);//产品图片 72 | con.close(); 73 | }catch(Exception e){} 74 | %> 75 |
76 | 77 | 78 | -------------------------------------------------------------------------------- /src/mybean/data/DataByPage.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dpl12/CosmeticsSales/04d89f0993573e73023f46087c7c5967d6cf9d30/src/mybean/data/DataByPage.java -------------------------------------------------------------------------------- /src/mybean/data/Login.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dpl12/CosmeticsSales/04d89f0993573e73023f46087c7c5967d6cf9d30/src/mybean/data/Login.java -------------------------------------------------------------------------------- /src/mybean/data/Register.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dpl12/CosmeticsSales/04d89f0993573e73023f46087c7c5967d6cf9d30/src/mybean/data/Register.java -------------------------------------------------------------------------------- /src/myservlet/control/HandleBuyGoods.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dpl12/CosmeticsSales/04d89f0993573e73023f46087c7c5967d6cf9d30/src/myservlet/control/HandleBuyGoods.java -------------------------------------------------------------------------------- /src/myservlet/control/HandleDelete.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dpl12/CosmeticsSales/04d89f0993573e73023f46087c7c5967d6cf9d30/src/myservlet/control/HandleDelete.java -------------------------------------------------------------------------------- /src/myservlet/control/HandleExit.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dpl12/CosmeticsSales/04d89f0993573e73023f46087c7c5967d6cf9d30/src/myservlet/control/HandleExit.java -------------------------------------------------------------------------------- /src/myservlet/control/HandleLogin.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dpl12/CosmeticsSales/04d89f0993573e73023f46087c7c5967d6cf9d30/src/myservlet/control/HandleLogin.java -------------------------------------------------------------------------------- /src/myservlet/control/HandleRegister.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dpl12/CosmeticsSales/04d89f0993573e73023f46087c7c5967d6cf9d30/src/myservlet/control/HandleRegister.java -------------------------------------------------------------------------------- /src/myservlet/control/PutGoodsToCar.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dpl12/CosmeticsSales/04d89f0993573e73023f46087c7c5967d6cf9d30/src/myservlet/control/PutGoodsToCar.java -------------------------------------------------------------------------------- /src/myservlet/control/QueryAllRecord.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dpl12/CosmeticsSales/04d89f0993573e73023f46087c7c5967d6cf9d30/src/myservlet/control/QueryAllRecord.java -------------------------------------------------------------------------------- /src/myservlet/control/SearchByCondition.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dpl12/CosmeticsSales/04d89f0993573e73023f46087c7c5967d6cf9d30/src/myservlet/control/SearchByCondition.java --------------------------------------------------------------------------------