├── .idea ├── artifacts │ └── Estore_Web_exploded.xml ├── compiler.xml ├── encodings.xml ├── libraries │ └── lib.xml ├── misc.xml ├── modules.xml ├── vcs.xml └── webContexts.xml ├── Estore-media ├── tomcat 添加web应用包-2.png ├── tomcat 添加web应用包.png ├── web 项目打包-2.png ├── web 项目打包.png ├── web 项目路径.png ├── 主页1.png ├── 主页2.png ├── 主页3.png ├── 主页4.png ├── 主页5.png ├── 主页6.png ├── 主页7.png ├── 主页8.png ├── 全局配置-1.png ├── 全局配置-2.png ├── 全局配置-3.png ├── 数据库的配置.png ├── 注册.png ├── 添加 tomcat jar 包-2.png ├── 添加 tomcat jar 包.png ├── 添加图片的虚拟目录-2.png ├── 添加图片的虚拟目录-3.png ├── 添加图片的虚拟目录.png ├── 登录.png ├── 配置tomcat-2.png ├── 配置tomcat.png ├── 配置简介-1.png ├── 配置简介-2.png └── 项目目录介绍.png ├── Estore.iml ├── README.md ├── Tomcat图片路径.png ├── estore.sql ├── src ├── c3p0-config.xml └── cn │ └── nsu │ └── edu │ └── estore │ ├── dao │ ├── NodeDateDao.java │ ├── OrderDao.java │ ├── ProductDao.java │ ├── ProductDaoImp.java │ └── UserDao.java │ ├── domain │ ├── NodeDate.java │ ├── Order.java │ ├── OrderItem.java │ ├── PageBean.java │ ├── Product.java │ └── User.java │ ├── exception │ ├── ActiveCodeException.java │ ├── DataException.java │ ├── LoginException.java │ ├── RegistException.java │ └── addOrderException.java │ ├── service │ ├── NodeDateService.java │ ├── OrderService.java │ ├── ProductService.java │ └── UserService.java │ ├── utils │ ├── ActiveCodeUtils.java │ ├── CheckImgServlet.java │ ├── CookieUtils.java │ ├── DataSourceUtils.java │ ├── MailUtils.java │ ├── Md5Utils.java │ ├── Projectpath.java │ ├── UploadPic.java │ └── UploadUtils.java │ └── web │ ├── filter │ ├── AutoLoginFilter.java │ └── EncodingFilter.java │ └── servlet │ ├── AddOrderServlet.java │ ├── AddProductToCartServlet.java │ ├── CategoryServlet.java │ ├── ChangeCountServlet.java │ ├── FindCategoryServlet.java │ ├── LinkageServlet.java │ ├── LoginOutServlet.java │ ├── LoginServlet.java │ ├── ProductAddServlet.java │ ├── ProductDelByIdServlet.java │ ├── ProductDelSelectServlet.java │ ├── ProductFindAllServlet.java │ ├── ProductFindByIdServlet.java │ ├── ProductFindByPageCodeServlet.java │ ├── ProductFindByPageServlet.java │ ├── ProductSimpleServlet.java │ ├── ProductUpdateServlet.java │ ├── RegistServlet.java │ ├── RemoveProductFromCartServlet.java │ ├── RemoveSelectProductFromCartServlet.java │ └── UserActiveServlet.java ├── upload.zip ├── upload ├── 1.png ├── 10.jpg ├── 11.png ├── 12.png ├── 13.png ├── 14.png ├── 15.jpg ├── 16.png ├── 17.jpg ├── 18.jpg ├── 19.png ├── 2.png ├── 20.png ├── 21.png ├── 22.jpg ├── 23.jpg ├── 25.jpg ├── 26.png ├── 27.png ├── 28.jpg ├── 29.png ├── 3.png ├── 30.png ├── 31.jpg ├── 32.png ├── 33.png ├── 34.png ├── 35.png ├── 36.jpg ├── 37.jpg ├── 38.png ├── 39.png ├── 4.png ├── 40.png ├── 41.png ├── 42.png ├── 43.png ├── 44.jpg ├── 45.jpg ├── 46.jpg ├── 5.png ├── 6.jpg ├── 6.png ├── 7.jpg ├── 8.jpg ├── 9.jpg └── yy.png └── web ├── CategoryJS ├── jquery-3.1.1.min.js └── onloada.js ├── WEB-INF ├── lib │ ├── c3p0-0.9.1.2.jar │ ├── commons-beanutils-1.8.3.jar │ ├── commons-collections-3.2.1.jar │ ├── commons-dbutils-1.4.jar │ ├── commons-fileupload-1.2.1.jar │ ├── commons-io-1.4.jar │ ├── commons-lang-2.6.jar │ ├── commons-logging-1.1.1.jar │ ├── ezmorph-1.0.6.jar │ ├── json-lib-2.4-jdk15.jar │ ├── jstl.jar │ ├── mail.jar │ ├── mysql-connector-java-5.1.47.jar │ └── standard.jar ├── new_words.txt └── web.xml ├── addProduct.jsp ├── addProductToCartSuccessfull.jsp ├── error ├── activeuser_error.jsp └── registuser_error.jsp ├── fastbuy.jsp ├── home.jsp ├── home ├── CSS │ ├── bootstrap.min.css │ ├── jquery-ui.css │ └── main.css ├── JS │ ├── bg-canvas.js │ ├── bootstrap.min.js │ ├── jquery-ui.js │ ├── jquery.min.js │ └── main.js └── img │ ├── 22d94f6e50d98f6f68308814ff9795e2.jpg │ ├── 260f712dc7bc066d147e305664ccd209.jpg │ ├── 387064f7e285263ac3ef81dd09baf5e4.png │ ├── 40ff95a5685129d242841d69e86f45d5.png │ ├── 43a307471a19a9a0c54fa19a4328bf5e.png │ ├── 43fa848fa20b7568d825bfa1bf8826f6.jpg │ ├── 4d98b5a1ad13dfdf6bf363a19dc88b2d.png │ ├── 5b59d6d7503f921a1a5590a1999f9a3f.jpg │ ├── 62f38e9081afaf20535678571aaf6b3b.jpg │ ├── 8cbbaae5979d138dbc9e9616a06ba125.png │ ├── 96d31465c590e6a93094d6cf016f36e6.png │ ├── 9beed483ba60c3ba71e72ad1cdb6d653.png │ ├── 9fb4c3da041a492d3853158c928da7ae.png │ ├── a26257f984753c787d177d74abaa7f04.png │ ├── add.png │ ├── bg.png │ ├── dd1c6b91990dee6177ad2ef4c1fb076e.png │ ├── e557c50318135d0f705498c91ae62852.jpg │ ├── gou.png │ ├── holiday_hero_subhead_2a_largetall.jpg │ ├── icon.png │ ├── iphone_square_large.jpg │ ├── logo.png │ ├── macbookpro_large.jpg │ ├── preloader.gif │ ├── tile_macos_large.jpg │ └── top.png ├── index.jsp ├── order.jsp ├── order_success.jsp ├── product.jsp ├── productInfo_admin.jsp ├── productInfo_user.jsp ├── regist_success.jsp ├── showProducts.jsp └── showcart.jsp /.idea/artifacts/Estore_Web_exploded.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | $PROJECT_DIR$/out/artifacts/Estore_Web_exploded 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/libraries/lib.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/webContexts.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 10 | -------------------------------------------------------------------------------- /Estore-media/tomcat 添加web应用包-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/Estore-media/tomcat 添加web应用包-2.png -------------------------------------------------------------------------------- /Estore-media/tomcat 添加web应用包.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/Estore-media/tomcat 添加web应用包.png -------------------------------------------------------------------------------- /Estore-media/web 项目打包-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/Estore-media/web 项目打包-2.png -------------------------------------------------------------------------------- /Estore-media/web 项目打包.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/Estore-media/web 项目打包.png -------------------------------------------------------------------------------- /Estore-media/web 项目路径.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/Estore-media/web 项目路径.png -------------------------------------------------------------------------------- /Estore-media/主页1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/Estore-media/主页1.png -------------------------------------------------------------------------------- /Estore-media/主页2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/Estore-media/主页2.png -------------------------------------------------------------------------------- /Estore-media/主页3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/Estore-media/主页3.png -------------------------------------------------------------------------------- /Estore-media/主页4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/Estore-media/主页4.png -------------------------------------------------------------------------------- /Estore-media/主页5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/Estore-media/主页5.png -------------------------------------------------------------------------------- /Estore-media/主页6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/Estore-media/主页6.png -------------------------------------------------------------------------------- /Estore-media/主页7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/Estore-media/主页7.png -------------------------------------------------------------------------------- /Estore-media/主页8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/Estore-media/主页8.png -------------------------------------------------------------------------------- /Estore-media/全局配置-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/Estore-media/全局配置-1.png -------------------------------------------------------------------------------- /Estore-media/全局配置-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/Estore-media/全局配置-2.png -------------------------------------------------------------------------------- /Estore-media/全局配置-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/Estore-media/全局配置-3.png -------------------------------------------------------------------------------- /Estore-media/数据库的配置.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/Estore-media/数据库的配置.png -------------------------------------------------------------------------------- /Estore-media/注册.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/Estore-media/注册.png -------------------------------------------------------------------------------- /Estore-media/添加 tomcat jar 包-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/Estore-media/添加 tomcat jar 包-2.png -------------------------------------------------------------------------------- /Estore-media/添加 tomcat jar 包.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/Estore-media/添加 tomcat jar 包.png -------------------------------------------------------------------------------- /Estore-media/添加图片的虚拟目录-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/Estore-media/添加图片的虚拟目录-2.png -------------------------------------------------------------------------------- /Estore-media/添加图片的虚拟目录-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/Estore-media/添加图片的虚拟目录-3.png -------------------------------------------------------------------------------- /Estore-media/添加图片的虚拟目录.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/Estore-media/添加图片的虚拟目录.png -------------------------------------------------------------------------------- /Estore-media/登录.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/Estore-media/登录.png -------------------------------------------------------------------------------- /Estore-media/配置tomcat-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/Estore-media/配置tomcat-2.png -------------------------------------------------------------------------------- /Estore-media/配置tomcat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/Estore-media/配置tomcat.png -------------------------------------------------------------------------------- /Estore-media/配置简介-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/Estore-media/配置简介-1.png -------------------------------------------------------------------------------- /Estore-media/配置简介-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/Estore-media/配置简介-2.png -------------------------------------------------------------------------------- /Estore-media/项目目录介绍.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/Estore-media/项目目录介绍.png -------------------------------------------------------------------------------- /Estore.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Estore 2 | 3 | ### 前言 4 | 5 | 本项目是一个 `商城`项目 。 6 | 7 | 前端 参考 `爱否商城` , 8 | 9 | 后端 部分代码 引用 `传智播客` `黑马程序员` `JavaEE` 就业班 `web` 基础 10 | 11 | ### 适合人群 12 | 13 | - `Java` 基础 熟练应用者 14 | - 熟悉 `web` 开发 15 | 16 | ### 运行界面 17 | 18 | ![注册](https://github.com/gpengDemo/Estore/raw/master/Estore-media/注册.png) 19 | 20 | ![登录](https://github.com/gpengDemo/Estore/raw/master/Estore-media/登录.png) 21 | 22 | ![主页1](https://github.com/gpengDemo/Estore/raw/master/Estore-media/主页1.png) 23 | 24 | ![主页2](https://github.com/gpengDemo/Estore/raw/master/Estore-media/主页2.png) 25 | 26 | ![主页3](https://github.com/gpengDemo/Estore/raw/master/Estore-media/主页3.png) 27 | 28 | ![主页4](https://github.com/gpengDemo/Estore/raw/master/Estore-media/主页4.png) 29 | 30 | ![主页5](https://github.com/gpengDemo/Estore/raw/master/Estore-media/主页5.png) 31 | 32 | ![主页6](https://github.com/gpengDemo/Estore/raw/master/Estore-media/主页6.png) 33 | 34 | ![主页7](https://github.com/gpengDemo/Estore/raw/master/Estore-media/主页7.png) 35 | 36 | ![主页8](https://github.com/gpengDemo/Estore/raw/master/Estore-media/主页8.png) 37 | 38 | 39 | 40 | 41 | 42 | ### 项目环境 43 | 44 | 1. 开发工具 `IntelliJ IDEA` 45 | 2. 数据库 `Server version: 5.7.25 MySQL Community Server (GPL)` 46 | 3. 服务器 `apache-tomcat-9.0.19` 47 | 4. 数据库连接 `mysql-connector-java-5.1.47.jar` 48 | 49 | ### 使用方法 50 | 51 | #### 项目目录介绍 52 | 53 | ![项目目录介绍](https://github.com/gpengDemo/Estore/raw/master/Estore-media/项目目录介绍.png) 54 | 55 | 1. `upload` 目录为 `网页图片` 存放路径 56 | 2. `estore.sql` 为数据库文件 57 | 58 | #### 项目配置简介 59 | 60 | ##### 1. 打开工程 61 | 62 | ![配置简介-1](https://github.com/gpengDemo/Estore/raw/master/Estore-media/配置简介-1.png) 63 | 64 | 65 | 66 | ##### 2. 项目 `jdk` 选择 67 | 68 | ![配置简介-2](https://github.com/gpengDemo/Estore/raw/master/Estore-media/配置简介-2.png) 69 | 70 | 71 | 72 | ##### 3. `web`项目路径 73 | 74 | 检查`web`项目路径是否配置正确 75 | 76 | 它将是项目运行成功与否关键因素之一 77 | 78 | ![web 项目路径](https://github.com/gpengDemo/Estore/raw/master/Estore-media/web%20%E9%A1%B9%E7%9B%AE%E8%B7%AF%E5%BE%84.png) 79 | 80 | 81 | 82 | ##### 4. 配置`tomcat` 83 | 84 | ![配置tomcat](https://github.com/gpengDemo/Estore/raw/master/Estore-media/配置tomcat.png) 85 | 86 | 87 | 88 | ![配置tomcat-2](https://github.com/gpengDemo/Estore/raw/master/Estore-media/配置tomcat-2.png) 89 | 90 | ##### 5. 添加 `tomcat` `jar` 包 91 | 92 | ![添加 tomcat jar 包](https://github.com/gpengDemo/Estore/raw/master/Estore-media/%E6%B7%BB%E5%8A%A0%20tomcat%20jar%20%E5%8C%85.png) 93 | 94 | ![添加 tomcat jar 包-2](https://github.com/gpengDemo/Estore/raw/master/Estore-media/%E6%B7%BB%E5%8A%A0%20tomcat%20jar%20%E5%8C%85-2.png) 95 | 96 | ##### 6 . 项目打包 97 | 98 | ![web 项目打包](https://github.com/gpengDemo/Estore/raw/master/Estore-media/web%20%E9%A1%B9%E7%9B%AE%E6%89%93%E5%8C%85.png) 99 | 100 | 101 | 102 | ##### 7.`tomcat` 添加`web`应用包 103 | 104 | ![tomcat 添加web应用包](https://github.com/gpengDemo/Estore/raw/master/Estore-media/tomcat%20%E6%B7%BB%E5%8A%A0web%E5%BA%94%E7%94%A8%E5%8C%85.png) 105 | 106 | ![tomcat 添加web应用包-2](https://github.com/gpengDemo/Estore/raw/master/Estore-media/tomcat%20%E6%B7%BB%E5%8A%A0web%E5%BA%94%E7%94%A8%E5%8C%85-2.png) 107 | 108 | 109 | 110 | 111 | ##### 8.添加图片的虚拟目录 `upload` 112 | 113 | ![添加图片的虚拟目录](https://github.com/gpengDemo/Estore/raw/master/Estore-media/添加图片的虚拟目录.png) 114 | 115 | ![添加图片的虚拟目录-2](https://github.com/gpengDemo/Estore/raw/master/Estore-media/添加图片的虚拟目录-2.png) 116 | 117 | ![添加图片的虚拟目录-3](https://github.com/gpengDemo/Estore/raw/master/Estore-media/添加图片的虚拟目录-3.png) 118 | 119 | 120 | 121 | ##### 9.数据库的配置 122 | 123 | 创建数据库 导入 `sql` 文件 124 | 125 | 修改 `c3p0-config.xml` 配置文件 `步骤略` 126 | 127 | ![数据库的配置](https://github.com/gpengDemo/Estore/raw/master/Estore-media/数据库的配置.png) 128 | 129 | 130 | 131 | 132 | 133 | ### 注意事项 134 | 135 | - `IntelliJ IDEA` 中文乱码 136 | 137 | #### 解决 `IntelliJ IDEA` 中文乱码 138 | 139 | 字符编码的设置 140 | 141 | ##### 全局配置-1 142 | 143 | ![全局配置-1](https://github.com/gpengDemo/Estore/raw/master/Estore-media/全局配置-1.png) 144 | 145 | ##### 全局配置-2 146 | 147 | ![全局配置-2](https://github.com/gpengDemo/Estore/raw/master/Estore-media/全局配置-2.png) 148 | 149 | ##### 全局配置-3 150 | 151 | ##### ![全局配置-3](https://github.com/gpengDemo/Estore/raw/master/Estore-media/全局配置-3.png) 152 | 153 | 154 | 155 | 156 | -------------------------------------------------------------------------------- /Tomcat图片路径.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/Tomcat图片路径.png -------------------------------------------------------------------------------- /src/c3p0-config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | root 5 | 1234 6 | com.mysql.jdbc.Driver 7 | jdbc:mysql://localhost:3306/estore 8 | 9 | 10 | -------------------------------------------------------------------------------- /src/cn/nsu/edu/estore/dao/NodeDateDao.java: -------------------------------------------------------------------------------- 1 | package cn.nsu.edu.estore.dao; 2 | 3 | import java.sql.SQLException; 4 | import java.util.List; 5 | 6 | import org.apache.commons.dbutils.QueryRunner; 7 | import org.apache.commons.dbutils.handlers.BeanHandler; 8 | import org.apache.commons.dbutils.handlers.BeanListHandler; 9 | import org.apache.commons.dbutils.handlers.ScalarHandler; 10 | 11 | import cn.nsu.edu.estore.domain.NodeDate; 12 | import cn.nsu.edu.estore.utils.DataSourceUtils; 13 | 14 | public class NodeDateDao { 15 | public List getCName(int level) throws SQLException { 16 | String sql = "select * from category where length(code)="+(level*2); 17 | QueryRunner runner = new QueryRunner(DataSourceUtils.getDataSource()); 18 | return runner.query(sql, new BeanListHandler(NodeDate.class)); 19 | } 20 | 21 | public List getNextName(String code) throws SQLException { 22 | String sql = "select * from category where fathercode="+code; 23 | QueryRunner runner = new QueryRunner(DataSourceUtils.getDataSource()); 24 | return runner.query(sql, new BeanListHandler(NodeDate.class)); 25 | } 26 | 27 | public int getCode(String name) throws SQLException { 28 | String sql = "select * from category where name="+name; 29 | QueryRunner runner = new QueryRunner(DataSourceUtils.getDataSource()); 30 | long code = (long) runner.query(sql, new ScalarHandler()); 31 | return (int) code; 32 | } 33 | 34 | public NodeDate getNoeDate(String name) throws SQLException { 35 | String sql = " select * from category where name =?"; 36 | QueryRunner runner = new QueryRunner(DataSourceUtils.getDataSource()); 37 | return runner.query(sql, new BeanHandler(NodeDate.class),name); 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /src/cn/nsu/edu/estore/dao/OrderDao.java: -------------------------------------------------------------------------------- 1 | package cn.nsu.edu.estore.dao; 2 | 3 | import java.sql.SQLException; 4 | 5 | import org.apache.commons.dbutils.QueryRunner; 6 | 7 | import cn.nsu.edu.estore.domain.Order; 8 | import cn.nsu.edu.estore.utils.DataSourceUtils; 9 | 10 | public class OrderDao { 11 | 12 | //添加订单操作 13 | public int addOrder(Order order) throws SQLException { 14 | String sql="insert into orders values(null,?,?,?,null,null)"; 15 | QueryRunner runner = new QueryRunner(DataSourceUtils.getDataSource()); 16 | return runner.update(sql,order.getMoney(),order.getReceiverinfo(),order.getPaystate()); 17 | } 18 | 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/cn/nsu/edu/estore/dao/ProductDao.java: -------------------------------------------------------------------------------- 1 | package cn.nsu.edu.estore.dao; 2 | 3 | import java.sql.SQLException; 4 | import java.util.List; 5 | 6 | import cn.nsu.edu.estore.domain.NodeDate; 7 | import cn.nsu.edu.estore.domain.Product; 8 | 9 | public interface ProductDao { 10 | //商品添加 11 | public void addProduct(Product product) throws SQLException; 12 | 13 | //删除单个商品信息 14 | public int delById(int id) throws SQLException; 15 | 16 | //批量删除勾选的客户信息 17 | public void delSelect(int[] id) throws SQLException; 18 | 19 | //查询所有商品信息 20 | public List findAll() throws SQLException; 21 | 22 | //通过id查找唯一商品 编辑商品信息 23 | public Product findById(int id) throws SQLException; 24 | public void update(Product p) throws SQLException; 25 | 26 | //按条件查询 27 | public List simpleSelect(String field, String msg) throws SQLException; 28 | 29 | //分页查询 30 | public List findByPage(int pageNum, int currentPage) throws SQLException; 31 | 32 | //得到所有页码 33 | public int findAllCount() throws SQLException; 34 | 35 | //得到所属分类的页码 36 | public int findCountByCode(String code) throws SQLException; 37 | 38 | //根据所传值得到在该分类的商品 39 | public List findByCode(String code) throws SQLException; 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/cn/nsu/edu/estore/dao/ProductDaoImp.java: -------------------------------------------------------------------------------- 1 | package cn.nsu.edu.estore.dao; 2 | 3 | import java.sql.SQLException; 4 | import java.util.List; 5 | 6 | import org.apache.commons.dbutils.QueryRunner; 7 | import org.apache.commons.dbutils.handlers.BeanHandler; 8 | import org.apache.commons.dbutils.handlers.BeanListHandler; 9 | import org.apache.commons.dbutils.handlers.ScalarHandler; 10 | 11 | import cn.nsu.edu.estore.domain.NodeDate; 12 | import cn.nsu.edu.estore.domain.Product; 13 | import cn.nsu.edu.estore.utils.DataSourceUtils; 14 | 15 | public class ProductDaoImp implements ProductDao { 16 | //商品添加 17 | public void addProduct(Product product) throws SQLException { 18 | String sql = "insert into products values(null,?,?,?,?,?,?,?)"; 19 | 20 | QueryRunner runner = new QueryRunner(DataSourceUtils.getDataSource()); 21 | 22 | runner.update(sql, product.getName(), product.getPrice(),product.getPnum(), 23 | product.getC3code(), product.getImgurl(), product.getDescription(), product.getColor()); 24 | } 25 | 26 | //查询所有商品信息 27 | public List findAll() throws SQLException { 28 | String sql = "select * from products "; 29 | QueryRunner runner = new QueryRunner(DataSourceUtils.getDataSource()); 30 | return runner.query(sql, new BeanListHandler(Product.class)); 31 | } 32 | 33 | //通过id查找唯一商品 34 | public Product findById(int id) throws SQLException { 35 | String sql = "select * from products where id=?"; 36 | QueryRunner runner = new QueryRunner(DataSourceUtils.getDataSource()); 37 | return runner.query(sql, new BeanHandler(Product.class), id); 38 | } 39 | 40 | //编辑商品信息 41 | public void update(Product p) throws SQLException { 42 | String sql = "update products set name=?,price=?,pnum=?,c3code=?," 43 | + "imgurl=?,description=?,color=? where id=?"; 44 | QueryRunner runner = new QueryRunner(DataSourceUtils.getDataSource()); 45 | runner.update(sql, p.getName(), p.getPrice(), p.getPnum(), p.getC3code(), 46 | p.getImgurl(), p.getDescription(), p.getColor(), p.getId()); 47 | } 48 | 49 | //按条件查询 50 | /*field为字段名称、msg为为字段值*/ 51 | public List simpleSelect(String field, String msg) throws SQLException { 52 | String sql = "select * from products where " + field + " like ?"; 53 | QueryRunner runner = new QueryRunner(DataSourceUtils.getDataSource()); 54 | return runner.query(sql, new BeanListHandler(Product.class), "%" + msg + "%"); 55 | } 56 | 57 | //分页查询 58 | /*pageNum为页码,currentPage为每页条数*/ 59 | public List findByPage(int pageNum, int currentPage) throws SQLException { 60 | String sql = "select * from products limit ?,?"; 61 | QueryRunner runner = new QueryRunner(DataSourceUtils.getDataSource()); 62 | return runner.query(sql, new BeanListHandler(Product.class), 63 | (pageNum - 1) * currentPage, currentPage); 64 | } 65 | 66 | //得到所有页码 67 | public int findAllCount() throws SQLException { 68 | String sql = "select count(*) from products"; 69 | QueryRunner runner = new QueryRunner(DataSourceUtils.getDataSource()); 70 | long count = (long) runner.query(sql, new ScalarHandler()); 71 | return (int) count; 72 | } 73 | 74 | //得到所属分类的页码 75 | public int findCountByCode(String code) throws SQLException { 76 | String sql = "select count(*) from products where substring(c3code,1,"+code.length()+")"+"=?"; 77 | QueryRunner runner = new QueryRunner(DataSourceUtils.getDataSource()); 78 | long count = (long) runner.query(sql, new ScalarHandler(), code); 79 | return (int) count; 80 | } 81 | 82 | //删除单个商品信息 83 | public int delById(int id) throws SQLException { 84 | String sql = "delete from products where id=?"; 85 | QueryRunner runner = new QueryRunner(DataSourceUtils.getDataSource()); 86 | int i = runner.update(sql, id); 87 | return i; 88 | } 89 | 90 | //批量删除商品信息 91 | public void delSelect(int[] id) throws SQLException { 92 | String sql = "delete from products where id=?"; 93 | QueryRunner runner = new QueryRunner(DataSourceUtils.getDataSource()); 94 | Object[][] ids = new Object[id.length][1]; 95 | for (int i = 0; i < id.length; i++) { 96 | ids[i][0] = id[i];//一维数组变成 二维数组batch方法的执行 97 | } 98 | 99 | runner.batch(sql, ids); 100 | } 101 | 102 | //根据所传值得到在该分类的商品 103 | public List findByCode(String code) throws SQLException { 104 | String sql = "select * from products where substring(c3code,1,"+code.length()+")"+"=?"; 105 | QueryRunner runner = new QueryRunner(DataSourceUtils.getDataSource()); 106 | return runner.query(sql, new BeanListHandler(Product.class), code); 107 | } 108 | 109 | public List findByPageByCode(int pageNum, int currentPage, String code) throws SQLException { 110 | String sql = "select * from products where substring(c3code,1,"+code.length()+")"+"=? limit ?,?"; 111 | QueryRunner runner = new QueryRunner(DataSourceUtils.getDataSource()); 112 | return runner.query(sql, new BeanListHandler(Product.class), code, 113 | (pageNum - 1) * currentPage, currentPage); 114 | } 115 | 116 | 117 | } 118 | -------------------------------------------------------------------------------- /src/cn/nsu/edu/estore/dao/UserDao.java: -------------------------------------------------------------------------------- 1 | package cn.nsu.edu.estore.dao; 2 | 3 | import java.sql.SQLException; 4 | 5 | import org.apache.commons.dbutils.QueryRunner; 6 | import org.apache.commons.dbutils.handlers.BeanHandler; 7 | 8 | import cn.nsu.edu.estore.domain.User; 9 | import cn.nsu.edu.estore.utils.DataSourceUtils; 10 | 11 | public class UserDao { 12 | //1. 注册操作 13 | public void addUser(User user) throws SQLException { 14 | 15 | String sql = "insert into users values(null,?,?,?,?,?,?,null)"; 16 | 17 | QueryRunner runner = new QueryRunner(DataSourceUtils.getDataSource()); 18 | 19 | runner.update(sql, user.getUsername(), 20 | user.getPassword(),user.getEmail(), "user", 0, user.getActivecode()); 21 | }//注:用户注册密码为了安全起见,要对密码进行加密,该项目中有Md5加密工具,防止书记泄露,,本次为了节约时间,此部分略过。。。。 22 | 23 | //2. 查找用户,根据激活码 24 | public User findUserByActiveCode(String activeCode) throws SQLException { 25 | 26 | String sql = "select * from users where activecode=?"; 27 | 28 | QueryRunner runner = new QueryRunner(DataSourceUtils.getDataSource()); 29 | 30 | return runner.query(sql, new BeanHandler(User.class), activeCode); 31 | } 32 | 33 | //3. 激活用户 34 | public void activeUser(String activeCode) throws SQLException { 35 | 36 | String sql = "update users set state=1 where activecode=?"; 37 | 38 | QueryRunner runner = new QueryRunner(DataSourceUtils.getDataSource()); 39 | 40 | runner.update(sql, activeCode); 41 | } 42 | 43 | //4. 登录操作 44 | public User findUserByLogin(String username, String password) throws SQLException { 45 | if (username.contains("@")) { 46 | 47 | String sql = "select * from users where email=? and password=?"; 48 | QueryRunner runner = new QueryRunner(DataSourceUtils.getDataSource()); 49 | return runner.query(sql, new BeanHandler(User.class), username, 50 | password); 51 | 52 | }else { 53 | String sql = "select * from users where username=? and password=?"; 54 | QueryRunner runner = new QueryRunner(DataSourceUtils.getDataSource()); 55 | return runner.query(sql, new BeanHandler(User.class), username, 56 | password); 57 | } 58 | } 59 | 60 | 61 | } 62 | -------------------------------------------------------------------------------- /src/cn/nsu/edu/estore/domain/NodeDate.java: -------------------------------------------------------------------------------- 1 | package cn.nsu.edu.estore.domain; 2 | 3 | public class NodeDate { 4 | private String code; 5 | private String name; 6 | private String fathercode; 7 | 8 | public String getCode() { 9 | return code; 10 | } 11 | 12 | public void setCode(String code) { 13 | this.code = code; 14 | } 15 | 16 | public String getName() { 17 | return name; 18 | } 19 | 20 | public void setName(String name) { 21 | this.name = name; 22 | } 23 | 24 | public String getFathercode() { 25 | return fathercode; 26 | } 27 | 28 | public void setFathercode(String fathercode) { 29 | this.fathercode = fathercode; 30 | } 31 | 32 | @Override 33 | public String toString() { 34 | return "NodeDate [code=" + code + ", name=" + name + ", fathercode=" + fathercode + "]"; 35 | } 36 | 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/cn/nsu/edu/estore/domain/Order.java: -------------------------------------------------------------------------------- 1 | package cn.nsu.edu.estore.domain; 2 | 3 | import java.sql.Timestamp; 4 | 5 | public class Order { 6 | 7 | 8 | private int id; // 订单号 9 | private double money; // 金额 10 | private String receiverinfo; // 收货人信息 11 | private int paystate; // 支付状态 12 | private Timestamp ordertime; // 下单时间 13 | private int user_id; // 下单用户 14 | 15 | public int getId() { 16 | return id; 17 | } 18 | public void setId(int id) { 19 | this.id = id; 20 | } 21 | public double getMoney() { 22 | return money; 23 | } 24 | public void setMoney(double money) { 25 | this.money = money; 26 | } 27 | public String getReceiverinfo() { 28 | return receiverinfo; 29 | } 30 | public void setReceiverinfo(String receiverinfo) { 31 | this.receiverinfo = receiverinfo; 32 | } 33 | public int getPaystate() { 34 | return paystate; 35 | } 36 | public void setPaystate(int paystate) { 37 | this.paystate = paystate; 38 | } 39 | public Timestamp getOrdertime() { 40 | return ordertime; 41 | } 42 | public void setOrdertime(Timestamp ordertime) { 43 | this.ordertime = ordertime; 44 | } 45 | public int getUser_id() { 46 | return user_id; 47 | } 48 | public void setUser_id(int user_id) { 49 | this.user_id = user_id; 50 | } 51 | public Order() { 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /src/cn/nsu/edu/estore/domain/OrderItem.java: -------------------------------------------------------------------------------- 1 | package cn.nsu.edu.estore.domain; 2 | 3 | 4 | /** 5 | * 订单中一项 6 | */ 7 | public class OrderItem { 8 | private String order_id; // 订单号 9 | private String product_id; // 商品号 10 | private int buynum; // 购买数量 11 | 12 | // 添加product的名称和单价 13 | private String name; 14 | private double price; 15 | 16 | public String getOrder_id() { 17 | return order_id; 18 | } 19 | 20 | public void setOrder_id(String orderId) { 21 | order_id = orderId; 22 | } 23 | 24 | public String getProduct_id() { 25 | return product_id; 26 | } 27 | 28 | public void setProduct_id(String productId) { 29 | product_id = productId; 30 | } 31 | 32 | public int getBuynum() { 33 | return buynum; 34 | } 35 | 36 | public void setBuynum(int buynum) { 37 | this.buynum = buynum; 38 | } 39 | 40 | public void setName(String name) { 41 | this.name = name; 42 | } 43 | 44 | public String getName() { 45 | return name; 46 | } 47 | 48 | public void setPrice(double price) { 49 | this.price = price; 50 | } 51 | 52 | public double getPrice() { 53 | return price; 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /src/cn/nsu/edu/estore/domain/PageBean.java: -------------------------------------------------------------------------------- 1 | package cn.nsu.edu.estore.domain; 2 | import java.util.List; 3 | 4 | public class PageBean { 5 | private int pageNum; // 页码 6 | private int currentPage; // 每页条数 7 | private int totalPage; // 总页数 8 | private int totalCount; // 总条数 9 | private List pro; // 每页数据 10 | 11 | public int getPageNum() { 12 | return pageNum; 13 | } 14 | 15 | public void setPageNum(int pageNum) { 16 | this.pageNum = pageNum; 17 | } 18 | 19 | public int getCurrentPage() { 20 | return currentPage; 21 | } 22 | 23 | public void setCurrentPage(int currentPage) { 24 | this.currentPage = currentPage; 25 | } 26 | 27 | public int getTotalPage() { 28 | return totalPage; 29 | } 30 | 31 | public void setTotalPage(int totalPage) { 32 | this.totalPage = totalPage; 33 | } 34 | 35 | public int getTotalCount() { 36 | return totalCount; 37 | } 38 | 39 | public void setTotalCount(int totalCount) { 40 | this.totalCount = totalCount; 41 | } 42 | 43 | public List getPro() { 44 | return pro; 45 | } 46 | 47 | public void setPro(List pro) { 48 | this.pro = pro; 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /src/cn/nsu/edu/estore/domain/Product.java: -------------------------------------------------------------------------------- 1 | package cn.nsu.edu.estore.domain; 2 | 3 | public class Product { 4 | private int id; // 商品编号 5 | private String name; // 名称 6 | private double price; // 价格 7 | private int pnum; // 数量 8 | private int c3code; 9 | private String imgurl; // 图片路径 10 | private String description; // 描述 11 | private String color; 12 | private int totalSaleNum; // 总销售数量 13 | 14 | public int getId() { 15 | return id; 16 | } 17 | 18 | public void setId(int id) { 19 | this.id = id; 20 | } 21 | 22 | public String getName() { 23 | return name; 24 | } 25 | 26 | public void setName(String name) { 27 | this.name = name; 28 | } 29 | 30 | public double getPrice() { 31 | return price; 32 | } 33 | 34 | public void setPrice(double price) { 35 | this.price = price; 36 | } 37 | 38 | 39 | public int getC3code() { 40 | return c3code; 41 | } 42 | 43 | public void setC3code(int c3code) { 44 | this.c3code = c3code; 45 | } 46 | 47 | public int getPnum() { 48 | return pnum; 49 | } 50 | 51 | public void setPnum(int pnum) { 52 | this.pnum = pnum; 53 | } 54 | 55 | public String getImgurl() { 56 | return imgurl; 57 | } 58 | 59 | public void setImgurl(String imgurl) { 60 | this.imgurl = imgurl; 61 | } 62 | 63 | public String getDescription() { 64 | return description; 65 | } 66 | 67 | public void setDescription(String description) { 68 | this.description = description; 69 | } 70 | 71 | public int getTotalSaleNum() { 72 | return totalSaleNum; 73 | } 74 | 75 | public void setTotalSaleNum(int totalSaleNum) { 76 | this.totalSaleNum = totalSaleNum; 77 | } 78 | 79 | 80 | public String getColor() { 81 | return color; 82 | } 83 | 84 | public void setColor(String color) { 85 | this.color = color; 86 | } 87 | 88 | public Product() { 89 | } 90 | 91 | @Override 92 | public int hashCode() { 93 | final int prime = 31; 94 | int result = 1; 95 | result = prime * result + id; 96 | return result; 97 | } 98 | 99 | @Override 100 | public boolean equals(Object obj) { 101 | if (this == obj) 102 | return true; 103 | if (obj == null) 104 | return false; 105 | if (getClass() != obj.getClass()) 106 | return false; 107 | Product other = (Product) obj; 108 | if (id != other.id) 109 | return false; 110 | return true; 111 | } 112 | 113 | 114 | } 115 | -------------------------------------------------------------------------------- /src/cn/nsu/edu/estore/domain/User.java: -------------------------------------------------------------------------------- 1 | package cn.nsu.edu.estore.domain; 2 | 3 | import java.sql.Timestamp; 4 | import java.util.HashMap; 5 | import java.util.Map; 6 | 7 | /** 8 | * 用户表 9 | */ 10 | public class User { 11 | private int id; // 用户编号 12 | private String username; // 用户名 13 | private String password; // 密码 14 | private String email; // 邮箱 15 | private String role; // 角色 默认是user 16 | private int state; // 是否激活 0 未激活 17 | private String activecode; // 激活码 UUID获取 18 | private Timestamp updatetime; // 更新时间 19 | 20 | public int getId() { 21 | return id; 22 | } 23 | 24 | public void setId(int id) { 25 | this.id = id; 26 | } 27 | 28 | public String getUsername() { 29 | return username; 30 | } 31 | 32 | public void setUsername(String username) { 33 | this.username = username; 34 | } 35 | 36 | public String getPassword() { 37 | return password; 38 | } 39 | 40 | public void setPassword(String password) { 41 | this.password = password; 42 | } 43 | 44 | public String getEmail() { 45 | return email; 46 | } 47 | 48 | public void setEmail(String email) { 49 | this.email = email; 50 | } 51 | 52 | public String getRole() { 53 | return role; 54 | } 55 | 56 | public void setRole(String role) { 57 | this.role = role; 58 | } 59 | 60 | public int getState() { 61 | return state; 62 | } 63 | 64 | public void setState(int state) { 65 | this.state = state; 66 | } 67 | 68 | public String getActivecode() { 69 | return activecode; 70 | } 71 | 72 | public void setActivecode(String activecode) { 73 | this.activecode = activecode; 74 | } 75 | 76 | public Timestamp getUpdatetime() { 77 | return updatetime; 78 | } 79 | 80 | public void setUpdatetime(Timestamp updatetime) { 81 | this.updatetime = updatetime; 82 | } 83 | /** 84 | * 对用户密码进行非空验证 85 | * @return 如果用户名、密码为空,抛出用户名,密码为空即可 86 | */ 87 | public Map validation() { 88 | Map map = new HashMap(); 89 | if (username == null || username.trim().length() == 0) { 90 | map.put("regist.username.error", "用户名不能为空"); 91 | } 92 | if (password == null || password.trim().length() == 0) { 93 | map.put("regist.password.error", "密码不能为空"); 94 | } 95 | return map; 96 | } 97 | 98 | } 99 | -------------------------------------------------------------------------------- /src/cn/nsu/edu/estore/exception/ActiveCodeException.java: -------------------------------------------------------------------------------- 1 | package cn.nsu.edu.estore.exception; 2 | 3 | @SuppressWarnings("all") 4 | public class ActiveCodeException extends Exception{ 5 | public ActiveCodeException() { 6 | super(); 7 | } 8 | 9 | public ActiveCodeException(String message, Throwable cause, 10 | boolean enableSuppression, boolean writableStackTrace) { 11 | super(message, cause, enableSuppression, writableStackTrace); 12 | } 13 | 14 | public ActiveCodeException(String message, Throwable cause) { 15 | super(message, cause); 16 | } 17 | 18 | public ActiveCodeException(String message) { 19 | super(message); 20 | } 21 | 22 | public ActiveCodeException(Throwable cause) { 23 | super(cause); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/cn/nsu/edu/estore/exception/DataException.java: -------------------------------------------------------------------------------- 1 | package cn.nsu.edu.estore.exception; 2 | 3 | public class DataException extends Exception { 4 | public DataException() { 5 | super(); 6 | } 7 | 8 | public DataException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { 9 | super(message, cause, enableSuppression, writableStackTrace); 10 | } 11 | 12 | public DataException(String message, Throwable cause) { 13 | super(message, cause); 14 | } 15 | 16 | public DataException(String message) { 17 | super(message); 18 | } 19 | 20 | public DataException(Throwable cause) { 21 | super(cause); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/cn/nsu/edu/estore/exception/LoginException.java: -------------------------------------------------------------------------------- 1 | package cn.nsu.edu.estore.exception; 2 | 3 | public class LoginException extends Exception{ 4 | 5 | public LoginException() { 6 | super(); 7 | } 8 | 9 | public LoginException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { 10 | super(message, cause, enableSuppression, writableStackTrace); 11 | } 12 | 13 | public LoginException(String message, Throwable cause) { 14 | super(message, cause); 15 | } 16 | 17 | public LoginException(String message) { 18 | super(message); 19 | } 20 | 21 | public LoginException(Throwable cause) { 22 | super(cause); 23 | } 24 | 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/cn/nsu/edu/estore/exception/RegistException.java: -------------------------------------------------------------------------------- 1 | package cn.nsu.edu.estore.exception; 2 | 3 | public class RegistException extends Exception { 4 | public RegistException() { 5 | super(); 6 | } 7 | 8 | public RegistException(String message, Throwable cause, 9 | boolean enableSuppression, boolean writableStackTrace) { 10 | super(message, cause, enableSuppression, writableStackTrace); 11 | } 12 | 13 | public RegistException(String message, Throwable cause) { 14 | super(message, cause); 15 | 16 | } 17 | 18 | public RegistException(String message) { 19 | super(message); 20 | } 21 | 22 | public RegistException(Throwable cause) { 23 | super(cause); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/cn/nsu/edu/estore/exception/addOrderException.java: -------------------------------------------------------------------------------- 1 | package cn.nsu.edu.estore.exception; 2 | 3 | public class addOrderException extends Exception { 4 | 5 | public addOrderException() { 6 | super(); 7 | // TODO Auto-generated constructor stub 8 | } 9 | 10 | public addOrderException(String arg0, Throwable arg1, boolean arg2, boolean arg3) { 11 | super(arg0, arg1, arg2, arg3); 12 | // TODO Auto-generated constructor stub 13 | } 14 | 15 | public addOrderException(String arg0, Throwable arg1) { 16 | super(arg0, arg1); 17 | // TODO Auto-generated constructor stub 18 | } 19 | 20 | public addOrderException(String arg0) { 21 | super(arg0); 22 | // TODO Auto-generated constructor stub 23 | } 24 | 25 | public addOrderException(Throwable arg0) { 26 | super(arg0); 27 | // TODO Auto-generated constructor stub 28 | } 29 | 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/cn/nsu/edu/estore/service/NodeDateService.java: -------------------------------------------------------------------------------- 1 | package cn.nsu.edu.estore.service; 2 | 3 | import java.sql.SQLException; 4 | import java.util.ArrayList; 5 | import java.util.HashMap; 6 | import java.util.List; 7 | 8 | import cn.nsu.edu.estore.dao.NodeDateDao; 9 | import cn.nsu.edu.estore.domain.NodeDate; 10 | 11 | public class NodeDateService { 12 | NodeDateDao dao = new NodeDateDao(); 13 | 14 | //获取目录名称 15 | public List getCName(int level) throws SQLException { 16 | return dao.getCName(level); 17 | } 18 | 19 | public List> getNextName(String code) throws SQLException { 20 | List> name = new ArrayList<>(); 21 | for (int i = 0; i < dao.getNextName(code).size(); i++) { 22 | HashMap map = new HashMap<>(); 23 | map.put("code", dao.getNextName(code).get(i).getCode()); 24 | map.put("name", dao.getNextName(code).get(i).getName()); 25 | name.add(map); 26 | } 27 | return name; 28 | } 29 | 30 | public NodeDate getNodeDate(String name) throws SQLException { 31 | return dao.getNoeDate(name); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/cn/nsu/edu/estore/service/OrderService.java: -------------------------------------------------------------------------------- 1 | package cn.nsu.edu.estore.service; 2 | 3 | import java.sql.SQLException; 4 | 5 | import cn.nsu.edu.estore.dao.OrderDao; 6 | import cn.nsu.edu.estore.domain.Order; 7 | import cn.nsu.edu.estore.exception.addOrderException; 8 | 9 | public class OrderService { 10 | public int addOrder(Order order) throws addOrderException { 11 | OrderDao dao=new OrderDao(); 12 | int i = 0; 13 | 14 | try { 15 | i = dao.addOrder(order); 16 | } catch (SQLException e) { 17 | throw new addOrderException("订单提交失败"); 18 | } 19 | return i; 20 | } 21 | 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/cn/nsu/edu/estore/service/ProductService.java: -------------------------------------------------------------------------------- 1 | package cn.nsu.edu.estore.service; 2 | 3 | import java.sql.SQLException; 4 | import java.util.List; 5 | 6 | import cn.nsu.edu.estore.dao.ProductDaoImp; 7 | import cn.nsu.edu.estore.domain.PageBean; 8 | import cn.nsu.edu.estore.domain.Product; 9 | import cn.nsu.edu.estore.exception.RegistException; 10 | 11 | public class ProductService { 12 | ProductDaoImp dao = new ProductDaoImp(); 13 | 14 | //添加商品 15 | public void add(Product product) throws SQLException { 16 | dao.addProduct(product); 17 | } 18 | 19 | //查询所有商品信息 20 | public List findAll() throws SQLException { 21 | return dao.findAll(); 22 | } 23 | 24 | //通过id查找唯一商品 25 | public Product findById(int id) throws SQLException { 26 | return dao.findById(id); 27 | } 28 | 29 | //修改产品信息 30 | public void update(Product product) throws SQLException { 31 | dao.update(product); 32 | } 33 | 34 | //按条件查询 35 | public List simpleSelect(String field, String msg) throws SQLException { 36 | return dao.simpleSelect(field, msg); 37 | } 38 | 39 | //分页查询 40 | public PageBean findByPage(int pageNum, int currentPage) { 41 | PageBean pb = new PageBean(); 42 | try { 43 | List pro = dao.findByPage(pageNum, currentPage); 44 | 45 | // 查询总条数: 46 | int totalCount = dao.findAllCount(); 47 | 48 | // 得到总页数 49 | int totalPage = (int) Math.ceil(totalCount * 1.0 / currentPage); 50 | 51 | pb.setTotalCount(totalCount); // 封装总条数 52 | pb.setTotalPage(totalPage);// 封装总页数 53 | pb.setPro(pro);// 封装当前页数据. 54 | pb.setCurrentPage(currentPage); // 封装每页条数 55 | pb.setPageNum(pageNum);// 封装当前页码 56 | 57 | } catch (SQLException e) { 58 | e.getStackTrace(); 59 | } 60 | return pb; 61 | } 62 | 63 | //得到所有页码 64 | public int findAllCount() throws SQLException { 65 | return dao.findAllCount(); 66 | } 67 | 68 | //删除单个数据 69 | public void delete(int id) throws SQLException { 70 | dao.delById(id); 71 | } 72 | 73 | //删除选中数据 74 | public void delSelect(int[] id) throws SQLException { 75 | dao.delSelect(id); 76 | } 77 | 78 | //根据所传值得到在该分类的商品 79 | public List findByCode(String code) throws SQLException { 80 | return dao.findByCode(code); 81 | } 82 | 83 | public PageBean findByPageByCode(int pageNum, int currentPage, String code) { 84 | PageBean pb = new PageBean(); 85 | try { 86 | List pro = dao.findByPageByCode(pageNum, currentPage, code); 87 | 88 | // 查询总条数: 89 | int totalCount = dao.findCountByCode(code); 90 | 91 | // 得到总页数 92 | int totalPage = (int) Math.ceil(totalCount * 1.0 / currentPage); 93 | 94 | pb.setTotalCount(totalCount); // 封装总条数 95 | pb.setTotalPage(totalPage);// 封装总页数 96 | pb.setPro(pro);// 封装当前页数据. 97 | pb.setCurrentPage(currentPage); // 封装每页条数 98 | pb.setPageNum(pageNum);// 封装当前页码 99 | 100 | } catch (SQLException e) { 101 | e.getStackTrace(); 102 | } 103 | return pb; 104 | } 105 | 106 | } 107 | -------------------------------------------------------------------------------- /src/cn/nsu/edu/estore/service/UserService.java: -------------------------------------------------------------------------------- 1 | package cn.nsu.edu.estore.service; 2 | 3 | import java.security.GeneralSecurityException; 4 | import java.sql.SQLException; 5 | 6 | import javax.mail.MessagingException; 7 | import javax.mail.internet.AddressException; 8 | import javax.security.auth.login.LoginException; 9 | 10 | import cn.nsu.edu.estore.dao.UserDao; 11 | import cn.nsu.edu.estore.domain.User; 12 | import cn.nsu.edu.estore.exception.ActiveCodeException; 13 | import cn.nsu.edu.estore.exception.RegistException; 14 | import cn.nsu.edu.estore.utils.MailUtils; 15 | 16 | public class UserService { 17 | /* 1.注册操作 START*/ 18 | public void regist(User user) throws RegistException { 19 | 20 | UserDao dao = new UserDao(); 21 | try { 22 | //1.添加注册用户信息 23 | dao.addUser(user); 24 | //2.向注册用户发送激活邮件 25 | String emailMsg = "注册成功,请点击下列连接已完成激活操作:(ps:由于邮箱原因,请复制链接打开!)"+"
"+ 26 | "http://localhost:8080/Estore/UserActiveServlet?activeCode="+user.getActivecode(); 27 | MailUtils.sendMail(user.getEmail(), emailMsg); 28 | } catch (SQLException e) { 29 | throw new RegistException("注册失败"); 30 | } catch (AddressException e) { 31 | e.printStackTrace(); 32 | } catch (MessagingException e) { 33 | e.printStackTrace(); 34 | } catch (GeneralSecurityException e) { 35 | // TODO Auto-generated catch block 36 | e.printStackTrace(); 37 | } 38 | } 39 | /*1. 注册操作 END*/ 40 | 41 | /*2. 激活用户操作 START*/ 42 | public void activeUser(String activeCode) throws ActiveCodeException { 43 | UserDao dao = new UserDao(); 44 | // 1.根据激活码查询用户,要判断激活码是否过期. 45 | 46 | try { 47 | User user = dao.findUserByActiveCode(activeCode); 48 | 49 | if (user != null) { 50 | // 2.进行激活操作 51 | 52 | long time = System.currentTimeMillis() 53 | - user.getUpdatetime().getTime(); 54 | 55 | if (time <= 24 * 60 * 1000 * 60) { 56 | // 激活 57 | try { 58 | dao.activeUser(activeCode); 59 | } catch (SQLException e) { 60 | throw new ActiveCodeException("激活用户失败"); 61 | } 62 | 63 | } else { 64 | throw new ActiveCodeException("激活码过期"); 65 | } 66 | } else { 67 | throw new ActiveCodeException("用户不存在"); 68 | } 69 | } catch (SQLException e) { 70 | throw new ActiveCodeException("查找激活用户失败"); 71 | } 72 | } 73 | /*2. 激活用户操作 START*/ 74 | 75 | /*3.登录操作 START*/ 76 | public User login(String username, String password) throws LoginException, ActiveCodeException { 77 | // 需要注意用户是否激活 78 | UserDao dao = new UserDao(); 79 | try { 80 | User user = dao.findUserByLogin(username, password); 81 | if (user != null) { 82 | // 判断用户是否激活 83 | if (user.getState() == 1) { 84 | return user; 85 | } else { 86 | throw new ActiveCodeException("用户未激活"); 87 | } 88 | } else { 89 | throw new LoginException("用户名或密码错误"); 90 | } 91 | } catch (SQLException e) { 92 | e.printStackTrace(); 93 | throw new LoginException("用户名或密码错误"); 94 | } 95 | 96 | } 97 | 98 | /*3.登录操作 END*/ 99 | } 100 | 101 | 102 | -------------------------------------------------------------------------------- /src/cn/nsu/edu/estore/utils/ActiveCodeUtils.java: -------------------------------------------------------------------------------- 1 | package cn.nsu.edu.estore.utils; 2 | 3 | import java.util.UUID; 4 | 5 | public class ActiveCodeUtils { 6 | 7 | public static String getActiveCode() { 8 | 9 | return UUID.randomUUID().toString(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/cn/nsu/edu/estore/utils/CheckImgServlet.java: -------------------------------------------------------------------------------- 1 | package cn.nsu.edu.estore.utils; 2 | 3 | import java.awt.Color; 4 | import java.awt.Font; 5 | import java.awt.Graphics; 6 | import java.awt.Graphics2D; 7 | import java.awt.image.BufferedImage; 8 | import java.io.BufferedReader; 9 | import java.io.FileReader; 10 | import java.io.IOException; 11 | import java.util.ArrayList; 12 | import java.util.List; 13 | import java.util.Random; 14 | 15 | import javax.imageio.ImageIO; 16 | import javax.servlet.ServletException; 17 | import javax.servlet.annotation.WebServlet; 18 | import javax.servlet.http.HttpServlet; 19 | import javax.servlet.http.HttpServletRequest; 20 | import javax.servlet.http.HttpServletResponse; 21 | 22 | /** 23 | * Servlet implementation class CheckImgServlet 24 | */ 25 | @WebServlet("/checkImg") 26 | /** 27 | * 验证码生成程序 28 | * 29 | * 30 | * 31 | */ 32 | public class CheckImgServlet extends HttpServlet { 33 | 34 | // 集合中保存所有成语 35 | private List words = new ArrayList(); 36 | 37 | @Override 38 | public void init() throws ServletException { 39 | // 初始化阶段,读取new_words.txt 40 | // web工程中读取 文件,必须使用绝对磁盘路径 41 | String path = getServletContext().getRealPath("/WEB-INF/new_words.txt"); 42 | try { 43 | BufferedReader reader = new BufferedReader(new FileReader(path)); 44 | String line; 45 | while ((line = reader.readLine()) != null) { 46 | words.add(line); 47 | } 48 | reader.close(); 49 | } catch (IOException e) { 50 | e.printStackTrace(); 51 | } 52 | } 53 | 54 | public void doGet(HttpServletRequest request, HttpServletResponse response) 55 | throws ServletException, IOException { 56 | // 禁止缓存 57 | // response.setHeader("Cache-Control", "no-cache"); 58 | // response.setHeader("Pragma", "no-cache"); 59 | // response.setDateHeader("Expires", -1); 60 | 61 | int width = 120; 62 | int height = 30; 63 | 64 | // 步骤一 绘制一张内存中图片 65 | BufferedImage bufferedImage = new BufferedImage(width, height, 66 | BufferedImage.TYPE_INT_RGB); 67 | 68 | // 步骤二 图片绘制背景颜色 ---通过绘图对象 69 | Graphics graphics = bufferedImage.getGraphics();// 得到画图对象 --- 画笔 70 | // 绘制任何图形之前 都必须指定一个颜色 71 | graphics.setColor(getRandColor(200, 250)); 72 | graphics.fillRect(0, 0, width, height); 73 | 74 | // 步骤三 绘制边框 75 | graphics.setColor(Color.WHITE); 76 | graphics.drawRect(0, 0, width - 1, height - 1); 77 | 78 | // 步骤四 四个随机数字 79 | Graphics2D graphics2d = (Graphics2D) graphics; 80 | // 设置输出字体 81 | graphics2d.setFont(new Font("宋体", Font.BOLD, 18)); 82 | 83 | Random random = new Random();// 生成随机数 84 | int index = random.nextInt(words.size()); 85 | String word = words.get(index);// 获得成语 86 | 87 | // 定义x坐标 88 | int x = 10; 89 | for (int i = 0; i < word.length(); i++) { 90 | // 随机颜色 91 | graphics2d.setColor(new Color(20 + random.nextInt(110), 20 + random 92 | .nextInt(110), 20 + random.nextInt(110))); 93 | // 旋转 -30 --- 30度 94 | int jiaodu = random.nextInt(60) - 30; 95 | // 换算弧度 96 | double theta = jiaodu * Math.PI / 180; 97 | 98 | // 获得字母数字 99 | char c = word.charAt(i); 100 | 101 | // 将c 输出到图片 102 | graphics2d.rotate(theta, x, 20); 103 | graphics2d.drawString(String.valueOf(c), x, 20); 104 | graphics2d.rotate(-theta, x, 20); 105 | x += 30; 106 | } 107 | 108 | // 将验证码内容保存session 109 | request.getSession().setAttribute("checkcode_session", word); 110 | 111 | // 步骤五 绘制干扰线 112 | graphics.setColor(getRandColor(160, 200)); 113 | int x1; 114 | int x2; 115 | int y1; 116 | int y2; 117 | for (int i = 0; i < 30; i++) { 118 | x1 = random.nextInt(width); 119 | x2 = random.nextInt(12); 120 | y1 = random.nextInt(height); 121 | y2 = random.nextInt(12); 122 | graphics.drawLine(x1, y1, x1 + x2, x2 + y2); 123 | } 124 | 125 | // 将上面图片输出到浏览器 ImageIO 126 | graphics.dispose();// 释放资源 127 | ImageIO.write(bufferedImage, "jpg", response.getOutputStream()); 128 | 129 | } 130 | 131 | public void doPost(HttpServletRequest request, HttpServletResponse response) 132 | throws ServletException, IOException { 133 | doGet(request, response); 134 | } 135 | 136 | /** 137 | * 取其某一范围的color 138 | * 139 | * @param fc 140 | * int 范围参数1 141 | * @param bc 142 | * int 范围参数2 143 | * @return Color 144 | */ 145 | private Color getRandColor(int fc, int bc) { 146 | // 取其随机颜色 147 | Random random = new Random(); 148 | if (fc > 255) { 149 | fc = 255; 150 | } 151 | if (bc > 255) { 152 | bc = 255; 153 | } 154 | int r = fc + random.nextInt(bc - fc); 155 | int g = fc + random.nextInt(bc - fc); 156 | int b = fc + random.nextInt(bc - fc); 157 | return new Color(r, g, b); 158 | } 159 | 160 | } -------------------------------------------------------------------------------- /src/cn/nsu/edu/estore/utils/CookieUtils.java: -------------------------------------------------------------------------------- 1 | package cn.nsu.edu.estore.utils; 2 | 3 | import javax.servlet.http.Cookie; 4 | 5 | public class CookieUtils { 6 | public static Cookie findCookieByName(Cookie[] cs, String name) { 7 | if (cs == null || cs.length == 0) { 8 | return null; 9 | } 10 | for (Cookie c : cs) { 11 | if (c.getName().equals(name)) { 12 | return c; 13 | } 14 | } 15 | return null; 16 | } 17 | 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/cn/nsu/edu/estore/utils/DataSourceUtils.java: -------------------------------------------------------------------------------- 1 | package cn.nsu.edu.estore.utils; 2 | 3 | import java.sql.Connection; 4 | import java.sql.SQLException; 5 | 6 | import javax.sql.DataSource; 7 | 8 | import com.mchange.v2.c3p0.ComboPooledDataSource; 9 | 10 | public class DataSourceUtils { 11 | private static DataSource dataSource = new ComboPooledDataSource(); 12 | 13 | private static final ThreadLocal tl = new ThreadLocal(); 14 | 15 | public static DataSource getDataSource() { 16 | return dataSource; 17 | } 18 | 19 | // 获取绑定到ThreadLocal中的Connection。 20 | public static Connection getConnectionByTransaction() throws SQLException { 21 | Connection con = tl.get(); 22 | if (con == null) { 23 | con = dataSource.getConnection(); 24 | tl.set(con); 25 | } 26 | 27 | return con; 28 | } 29 | 30 | // 开启事务 31 | public static void startTransaction(Connection con) throws SQLException { 32 | if (con != null) 33 | con.setAutoCommit(false); 34 | } 35 | 36 | // 事务回滚 37 | public static void rollback(Connection con) throws SQLException { 38 | if (con != null) 39 | con.rollback(); 40 | } 41 | 42 | public static void closeConnection(Connection con) throws SQLException { 43 | if (con != null) { 44 | con.commit();// 事务提交 45 | con.close(); 46 | tl.remove(); 47 | 48 | } 49 | } 50 | 51 | /** 52 | * 当DBUtils需要手动控制事务时,调用该方法获得一个连接 53 | * 54 | * @return 55 | * @throws SQLException 56 | */ 57 | public static Connection getConnection() throws SQLException { 58 | return dataSource.getConnection(); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/cn/nsu/edu/estore/utils/MailUtils.java: -------------------------------------------------------------------------------- 1 | package cn.nsu.edu.estore.utils; 2 | 3 | import java.security.GeneralSecurityException; 4 | import java.util.Properties; 5 | 6 | import javax.mail.Authenticator; 7 | import javax.mail.Message; 8 | import javax.mail.MessagingException; 9 | import javax.mail.PasswordAuthentication; 10 | import javax.mail.Session; 11 | import javax.mail.Transport; 12 | import javax.mail.internet.AddressException; 13 | import javax.mail.internet.InternetAddress; 14 | import javax.mail.internet.MimeMessage; 15 | 16 | public class MailUtils { 17 | 18 | public static void sendMail(String email,String emailInfo) 19 | throws AddressException, MessagingException, GeneralSecurityException { 20 | Properties prop=new Properties(); 21 | prop.put("mail.host","smtp.163.com" ); 22 | prop.put("mail.transport.protocol", "smtp"); 23 | prop.put("mail.smtp.auth", true); 24 | //1.创建sesssion 25 | Session session=Session.getInstance(prop); 26 | //开启session的调试模式,可以查看当前邮件发送状态 27 | session.setDebug(true); 28 | 29 | //2.通过session获取Transport对象(发送邮件的核心API) 30 | Transport ts=session.getTransport(); 31 | //3.通过邮件用户名密码(授权码 )链接 32 | ts.connect("17780713604@163.com", "hslzym1314"); 33 | 34 | //4.创建邮件 35 | Message msg=createSimpleMail(session,email,emailInfo); 36 | 37 | //5.发送电子邮件 38 | ts.sendMessage(msg, msg.getAllRecipients()); 39 | } 40 | private static Message createSimpleMail(Session session, String email, String emailInfo) throws AddressException, MessagingException { 41 | MimeMessage mm=new MimeMessage(session); 42 | //设置发件人 43 | mm.setFrom(new InternetAddress("17780713604@163.com")); 44 | //设置收件人 45 | mm.setRecipient(Message.RecipientType.TO, new InternetAddress(email)); 46 | mm.setSubject("测试邮件"); 47 | mm.setContent(emailInfo, "text/html;charset=gbk"); 48 | return mm; 49 | } 50 | } 51 | 52 | -------------------------------------------------------------------------------- /src/cn/nsu/edu/estore/utils/Md5Utils.java: -------------------------------------------------------------------------------- 1 | package cn.nsu.edu.estore.utils; 2 | 3 | import java.math.BigInteger; 4 | import java.security.MessageDigest; 5 | import java.security.NoSuchAlgorithmException; 6 | 7 | public class Md5Utils { 8 | /** 9 | * 使用md5的算法进行加密 10 | */ 11 | public static String md5(String plainText) { 12 | byte[] secretBytes = null; 13 | try { 14 | secretBytes = MessageDigest.getInstance("md5").digest( 15 | plainText.getBytes()); 16 | } catch (NoSuchAlgorithmException e) { 17 | throw new RuntimeException("没有md5这个算法!"); 18 | } 19 | String md5code = new BigInteger(1, secretBytes).toString(16);// 16进制数字 20 | // 如果生成数字未满32位,需要前面补0 21 | for (int i = 0; i < 32 - md5code.length(); i++) { 22 | md5code = "0" + md5code; 23 | } 24 | return md5code; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/cn/nsu/edu/estore/utils/Projectpath.java: -------------------------------------------------------------------------------- 1 | package cn.nsu.edu.estore.utils; 2 | 3 | public class Projectpath { 4 | 5 | static String path = System.getProperty("user.dir"); 6 | 7 | public static String getPath() { 8 | return path; 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /src/cn/nsu/edu/estore/utils/UploadPic.java: -------------------------------------------------------------------------------- 1 | package cn.nsu.edu.estore.utils; 2 | 3 | import java.awt.Image; 4 | import java.awt.image.BufferedImage; 5 | import java.io.File; 6 | import java.io.FileNotFoundException; 7 | import java.io.FileOutputStream; 8 | import java.io.IOException; 9 | import java.io.InputStream; 10 | 11 | import org.apache.commons.fileupload.FileItem; 12 | import org.apache.commons.io.IOUtils; 13 | 14 | import com.sun.image.codec.jpeg.JPEGCodec; 15 | import com.sun.image.codec.jpeg.JPEGImageEncoder; 16 | 17 | public class UploadPic { 18 | 19 | private static String path = "c:\\upload"; 20 | 21 | //上传图片 22 | public static void savePic(FileItem item, String filename) throws IOException { 23 | //创建文件上传路 24 | File file = new File(path); 25 | 26 | //判断路径是否存在 27 | if (!file.exists()) 28 | file.mkdirs(); 29 | 30 | //获取item中的上传文件的输入流 31 | InputStream in = item.getInputStream(); 32 | //创建一个文件输出流 33 | FileOutputStream out = new FileOutputStream(path + "\\" + filename); 34 | //创建一个缓冲区 35 | byte buffer[] = new byte[1024]; 36 | //判断输入流中的数据是否已经读完的标识 37 | int len = 0; 38 | //循环将输入流读入到缓冲区当中,(len=in.read(buffer))>0就表示in里面还有数据 39 | while((len=in.read(buffer))>0){ 40 | //使用FileOutputStream输出流将缓冲区的数据写入到指定的目录(savePath + "\\" + filename)当中 41 | out.write(buffer, 0, len); 42 | } 43 | in.close(); 44 | //关闭输出流 45 | out.close(); 46 | //删除处理文件上传时生成的临时文件 47 | item.delete(); 48 | 49 | } 50 | 51 | public String getPath() { 52 | return path; 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /src/cn/nsu/edu/estore/utils/UploadUtils.java: -------------------------------------------------------------------------------- 1 | package cn.nsu.edu.estore.utils; 2 | 3 | import java.util.UUID; 4 | 5 | public class UploadUtils { 6 | /** 7 | * 截取真实文件名 8 | * 9 | * @param fileName 10 | * @return 11 | */ 12 | public static String subFileName(String fileName) { 13 | // 查找最后一个 \出现位置 14 | int index = fileName.lastIndexOf("\\"); 15 | if (index == -1) { 16 | return fileName; 17 | } 18 | return fileName.substring(index + 1); 19 | } 20 | 21 | // 获得随机UUID文件名 22 | public static String generateRandonFileName(String fileName) { 23 | // 获得扩展名 24 | String ext = fileName.substring(fileName.lastIndexOf(".")); 25 | return UUID.randomUUID().toString() + ext; 26 | } 27 | 28 | // 获得hashcode生成二级目录 29 | public static String generateRandomDir(String uuidFileName) { 30 | int hashCode = uuidFileName.hashCode(); 31 | // 一级目录 32 | int d1 = hashCode & 0xf; 33 | // 二级目录 34 | int d2 = (hashCode >> 4) & 0xf; 35 | return "/" + d1 + "/" + d2; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/cn/nsu/edu/estore/web/filter/AutoLoginFilter.java: -------------------------------------------------------------------------------- 1 | package cn.nsu.edu.estore.web.filter; 2 | 3 | import java.io.IOException; 4 | import java.net.URLDecoder; 5 | 6 | import javax.servlet.FilterChain; 7 | import javax.servlet.FilterConfig; 8 | import javax.servlet.ServletException; 9 | import javax.servlet.ServletRequest; 10 | import javax.servlet.ServletResponse; 11 | import javax.servlet.annotation.WebServlet; 12 | import javax.servlet.http.Cookie; 13 | import javax.servlet.http.HttpServlet; 14 | import javax.servlet.http.HttpServletRequest; 15 | import javax.servlet.http.HttpServletResponse; 16 | 17 | import cn.nsu.edu.estore.domain.User; 18 | import cn.nsu.edu.estore.exception.ActiveCodeException; 19 | import cn.nsu.edu.estore.exception.LoginException; 20 | import cn.nsu.edu.estore.service.UserService; 21 | import cn.nsu.edu.estore.utils.CookieUtils; 22 | 23 | /** 24 | * Servlet implementation class AutoLoginFilter 25 | */ 26 | /*@WebServlet("")*/ 27 | /*public class AutoLoginFilter extends HttpServlet { 28 | private static final long serialVersionUID = 1L; 29 | 30 | public void init(FilterConfig filterConfig) throws ServletException { 31 | 32 | } 33 | 34 | public void doFilter(ServletRequest request, ServletResponse response, 35 | FilterChain chain) throws IOException, ServletException { 36 | // 处理请求乱码 37 | HttpServletRequest httpServletRequest = (HttpServletRequest) request; 38 | HttpServletResponse httpServletResponse = (HttpServletResponse) response; 39 | 40 | // 处理自动登录 41 | // 1.如果用户已经登录不需要自动登录 42 | User user = (User) httpServletRequest.getSession().getAttribute("user"); 43 | if (user == null) { 44 | // 没有登录,进行自动登录 45 | // 2.判断访问的资源路径,例如登录,注册不需要进行自动登录 46 | String uri = httpServletRequest.getRequestURI(); 47 | String contextPath = httpServletRequest.getContextPath(); 48 | String path = uri.substring(contextPath.length()); 49 | if (!("/regist".equals(path) || "/regist.jsp".equals(path) 50 | || "/login.jsp".equals(path) || "/logout".equals(path))) { 51 | 52 | // 3.得到Cookie 53 | Cookie cookie = CookieUtils.findCookieByName( 54 | httpServletRequest.getCookies(), "autologin"); 55 | if (cookie != null) { 56 | 57 | // 有cookie,进行登录操作. 58 | String username = URLDecoder.decode(cookie.getValue() 59 | .split("::")[0], "utf-8"); 60 | String password = cookie.getValue().split("::")[1]; 61 | 62 | UserService service = new UserService(); 63 | try { 64 | User u = service.login(username, password); 65 | if (u != null) { 66 | httpServletRequest.getSession().setAttribute( 67 | "user", u);// 进行自动登录. 68 | } 69 | } catch (javax.security.auth.login.LoginException e) { 70 | e.printStackTrace(); 71 | } catch (ActiveCodeException e) { 72 | e.printStackTrace(); 73 | } 74 | 75 | } 76 | 77 | } 78 | } 79 | 80 | // 放行 81 | chain.doFilter(httpServletRequest, httpServletResponse); 82 | } 83 | 84 | public void destroy() { 85 | 86 | } 87 | */ 88 | /*}*/ 89 | -------------------------------------------------------------------------------- /src/cn/nsu/edu/estore/web/filter/EncodingFilter.java: -------------------------------------------------------------------------------- 1 | package cn.nsu.edu.estore.web.filter; 2 | 3 | import java.io.IOException; 4 | import java.io.UnsupportedEncodingException; 5 | import java.util.Map; 6 | 7 | import javax.servlet.Filter; 8 | import javax.servlet.FilterChain; 9 | import javax.servlet.FilterConfig; 10 | import javax.servlet.ServletException; 11 | import javax.servlet.ServletRequest; 12 | import javax.servlet.ServletResponse; 13 | import javax.servlet.annotation.WebFilter; 14 | import javax.servlet.http.HttpServletRequest; 15 | import javax.servlet.http.HttpServletRequestWrapper; 16 | 17 | /** 18 | *通用解决 get 和 post乱码过滤器 19 | */ 20 | public class EncodingFilter implements Filter { 21 | 22 | 23 | public EncodingFilter() { } 24 | 25 | public void destroy() {} 26 | 27 | public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { 28 | // 处理请求乱码 29 | HttpServletRequest httpServletRequest = (HttpServletRequest) request; 30 | HttpServletRequest myRequest = new MyRequest(httpServletRequest); 31 | 32 | // 处理响应乱码 33 | response.setContentType("text/html;charset=utf-8"); 34 | 35 | chain.doFilter(myRequest, response); 36 | } 37 | 38 | 39 | public void init(FilterConfig fConfig) throws ServletException { 40 | } 41 | 42 | } 43 | //自定义request对象 44 | class MyRequest extends HttpServletRequestWrapper { 45 | 46 | private HttpServletRequest request; 47 | 48 | private boolean hasEncode; 49 | 50 | public MyRequest(HttpServletRequest request) { 51 | super(request);// super必须写 52 | this.request = request; 53 | } 54 | 55 | // 对需要增强方法 进行覆盖 56 | @Override 57 | public Map getParameterMap() { 58 | // 先获得请求方式 59 | String method = request.getMethod(); 60 | if (method.equalsIgnoreCase("post")) { 61 | // post请求 62 | try { 63 | // 处理post乱码 64 | request.setCharacterEncoding("utf-8"); 65 | return request.getParameterMap(); 66 | } catch (UnsupportedEncodingException e) { 67 | e.printStackTrace(); 68 | } 69 | } else if (method.equalsIgnoreCase("get")) { 70 | // get请求 71 | Map parameterMap = request.getParameterMap(); 72 | if (!hasEncode) { // 确保get手动编码逻辑只运行一次 73 | for (String parameterName : parameterMap.keySet()) { 74 | String[] values = parameterMap.get(parameterName); 75 | if (values != null) { 76 | for (int i = 0; i < values.length; i++) { 77 | try { 78 | // 处理get乱码 79 | values[i] = new String(values[i] 80 | .getBytes("ISO-8859-1"), "utf-8"); 81 | } catch (UnsupportedEncodingException e) { 82 | e.printStackTrace(); 83 | } 84 | } 85 | } 86 | } 87 | hasEncode = true; 88 | } 89 | return parameterMap; 90 | } 91 | 92 | return super.getParameterMap(); 93 | } 94 | 95 | @Override 96 | public String getParameter(String name) { 97 | Map parameterMap = getParameterMap(); 98 | String[] values = parameterMap.get(name); 99 | if (values == null) { 100 | return null; 101 | } 102 | return values[0]; // 取回参数的第一个值 103 | } 104 | 105 | @Override 106 | public String[] getParameterValues(String name) { 107 | Map parameterMap = getParameterMap(); 108 | String[] values = parameterMap.get(name); 109 | return values; 110 | } 111 | 112 | } 113 | 114 | -------------------------------------------------------------------------------- /src/cn/nsu/edu/estore/web/servlet/AddOrderServlet.java: -------------------------------------------------------------------------------- 1 | package cn.nsu.edu.estore.web.servlet; 2 | 3 | import java.io.IOException; 4 | import java.lang.reflect.InvocationTargetException; 5 | 6 | import javax.servlet.ServletException; 7 | import javax.servlet.annotation.WebServlet; 8 | import javax.servlet.http.HttpServlet; 9 | import javax.servlet.http.HttpServletRequest; 10 | import javax.servlet.http.HttpServletResponse; 11 | 12 | import org.apache.commons.beanutils.BeanUtils; 13 | 14 | import cn.nsu.edu.estore.domain.Order; 15 | import cn.nsu.edu.estore.exception.addOrderException; 16 | import cn.nsu.edu.estore.service.OrderService; 17 | 18 | /** 19 | * Servlet implementation class AddOrderServlet 20 | */ 21 | @WebServlet("/AddOrderServlet") 22 | public class AddOrderServlet extends HttpServlet { 23 | private static final long serialVersionUID = 1L; 24 | 25 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 26 | //1.得到实体类对象,将数据封装至实体类中 27 | Order order=new Order(); 28 | try { 29 | BeanUtils.populate(order, request.getParameterMap()); 30 | } catch (IllegalAccessException e) { 31 | e.printStackTrace(); 32 | } catch (InvocationTargetException e) { 33 | e.printStackTrace(); 34 | } 35 | 36 | OrderService service=new OrderService(); 37 | try { 38 | service.addOrder(order); 39 | response.sendRedirect(request.getContextPath() 40 | + "/index.jsp"); 41 | return; 42 | } catch (addOrderException e) { 43 | request.setAttribute("addOrder.message", e.getMessage()); 44 | request.getRequestDispatcher("/error/addOrder_error.jsp").forward(request, 45 | response); 46 | return; 47 | } 48 | } 49 | 50 | /** 51 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) 52 | */ 53 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 54 | // TODO Auto-generated method stub 55 | doGet(request, response); 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /src/cn/nsu/edu/estore/web/servlet/AddProductToCartServlet.java: -------------------------------------------------------------------------------- 1 | package cn.nsu.edu.estore.web.servlet; 2 | 3 | import java.io.IOException; 4 | import java.sql.SQLException; 5 | import java.util.HashMap; 6 | import java.util.Map; 7 | 8 | import javax.servlet.ServletException; 9 | import javax.servlet.annotation.WebServlet; 10 | import javax.servlet.http.HttpServlet; 11 | import javax.servlet.http.HttpServletRequest; 12 | import javax.servlet.http.HttpServletResponse; 13 | import javax.servlet.http.HttpSession; 14 | 15 | import cn.nsu.edu.estore.domain.Product; 16 | import cn.nsu.edu.estore.service.ProductService; 17 | 18 | /** 19 | * Servlet implementation class AddProductToCartServlet 20 | */ 21 | @WebServlet("/AddProductToCartServlet") 22 | public class AddProductToCartServlet extends HttpServlet { 23 | private static final long serialVersionUID = 1L; 24 | 25 | /** 26 | * @see HttpServlet#HttpServlet() 27 | */ 28 | public AddProductToCartServlet() { 29 | super(); 30 | // TODO Auto-generated constructor stub 31 | } 32 | 33 | /** 34 | * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) 35 | */ 36 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 37 | // 1.得到商品id 38 | String id = request.getParameter("id"); 39 | 40 | // 2.根据id查询商品 41 | ProductService service = new ProductService(); 42 | try { 43 | Product p = service.findById(Integer.parseInt(id)); 44 | 45 | // 3.将商品添加到购物车 46 | HttpSession session = request.getSession(); 47 | // 从session中获取购物车 48 | Map cart = (Map) session 49 | .getAttribute("cart"); 50 | // 如果cart为null,说明,没有购物车,是第一次购物 51 | if (cart == null) { 52 | // 创建出购物车 53 | cart = new HashMap(); 54 | } 55 | // 判断购物车中是滞有当前要买的商品 56 | Integer count = cart.get(p); 57 | if (count == null) { 58 | // 如果为null,说明购物车中没有这个商品,这时商品的数量就为1 59 | count = 1; 60 | } else { 61 | // 如果不为null,说明购物车中有这个商品,这时,就将商品的数量+1 62 | count += 1; 63 | } 64 | // 将商品存储到购物车中 65 | cart.put(p, count); 66 | // 将购物车存储到session中. 67 | session.setAttribute("cart", cart); 68 | 69 | response.sendRedirect(request.getContextPath()+"/addProductToCartSuccessfull.jsp"); 70 | // response.getWriter().write("添加商品到购物车成功,继续购物,查看购物车"); 71 | return; 72 | 73 | } catch (SQLException e) { 74 | e.printStackTrace(); 75 | } 76 | 77 | } 78 | 79 | /** 80 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) 81 | */ 82 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 83 | // TODO Auto-generated method stub 84 | doGet(request, response); 85 | } 86 | 87 | } 88 | -------------------------------------------------------------------------------- /src/cn/nsu/edu/estore/web/servlet/CategoryServlet.java: -------------------------------------------------------------------------------- 1 | package cn.nsu.edu.estore.web.servlet; 2 | 3 | import java.io.IOException; 4 | import java.sql.SQLException; 5 | import java.util.ArrayList; 6 | import java.util.List; 7 | 8 | import javax.servlet.ServletException; 9 | import javax.servlet.annotation.WebServlet; 10 | import javax.servlet.http.HttpServlet; 11 | import javax.servlet.http.HttpServletRequest; 12 | import javax.servlet.http.HttpServletResponse; 13 | 14 | import cn.nsu.edu.estore.domain.NodeDate; 15 | import cn.nsu.edu.estore.domain.User; 16 | import cn.nsu.edu.estore.service.NodeDateService; 17 | 18 | /** 19 | * Servlet implementation class CategoryServlet 20 | */ 21 | @WebServlet("/CategoryServlet") 22 | public class CategoryServlet extends HttpServlet { 23 | private static final long serialVersionUID = 1L; 24 | 25 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 26 | NodeDateService service = new NodeDateService(); 27 | try { 28 | List onelevel = service.getCName(1); 29 | request.getSession().setAttribute("onelevel", onelevel); 30 | User user = (User) request.getSession().getAttribute("user"); 31 | if (user == null || user.getRole().equals("user")) { 32 | request.getRequestDispatcher("/NewFile3.jsp").forward(request, response); 33 | return; 34 | } 35 | request.getRequestDispatcher("/addProduct.jsp").forward(request, response); 36 | return; 37 | } catch (SQLException e) { 38 | e.printStackTrace(); 39 | } 40 | } 41 | 42 | /** 43 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) 44 | */ 45 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 46 | // TODO Auto-generated method stub 47 | doGet(request, response); 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /src/cn/nsu/edu/estore/web/servlet/ChangeCountServlet.java: -------------------------------------------------------------------------------- 1 | package cn.nsu.edu.estore.web.servlet; 2 | 3 | import java.io.IOException; 4 | import java.util.Map; 5 | 6 | import javax.servlet.ServletException; 7 | import javax.servlet.annotation.WebServlet; 8 | import javax.servlet.http.HttpServlet; 9 | import javax.servlet.http.HttpServletRequest; 10 | import javax.servlet.http.HttpServletResponse; 11 | 12 | import cn.nsu.edu.estore.domain.Product; 13 | 14 | /** 15 | * Servlet implementation class ChangeCountServlet 16 | */ 17 | @WebServlet("/ChangeCountServlet") 18 | public class ChangeCountServlet extends HttpServlet { 19 | private static final long serialVersionUID = 1L; 20 | 21 | 22 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 23 | //1.得到请求参数 24 | int id=Integer.parseInt(request.getParameter("id")); 25 | int count=Integer.parseInt(request.getParameter("count")); 26 | 27 | //2.修稿购物车的指定数量 28 | //2.1得到购物车 29 | Map cart=(Map) request.getSession().getAttribute("cart"); 30 | //2.2修改购物车中的商品 31 | Product p=new Product(); 32 | p.setId(id); 33 | if (count == 0) { 34 | // 删除商品 35 | cart.remove(p); 36 | } else { 37 | cart.put(p, count); 38 | } 39 | response.sendRedirect(request.getContextPath() + "/showcart.jsp"); 40 | } 41 | 42 | /** 43 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) 44 | */ 45 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 46 | // TODO Auto-generated method stub 47 | doGet(request, response); 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /src/cn/nsu/edu/estore/web/servlet/FindCategoryServlet.java: -------------------------------------------------------------------------------- 1 | package cn.nsu.edu.estore.web.servlet; 2 | 3 | import java.io.IOException; 4 | import java.net.URLDecoder; 5 | import java.sql.SQLException; 6 | import java.util.HashMap; 7 | import java.util.List; 8 | 9 | import javax.servlet.ServletException; 10 | import javax.servlet.annotation.WebServlet; 11 | import javax.servlet.http.HttpServlet; 12 | import javax.servlet.http.HttpServletRequest; 13 | import javax.servlet.http.HttpServletResponse; 14 | 15 | import cn.nsu.edu.estore.domain.NodeDate; 16 | import cn.nsu.edu.estore.service.NodeDateService; 17 | 18 | /** 19 | * Servlet implementation class FindCategoryServlet 20 | */ 21 | @WebServlet("/FindCategoryServlet") 22 | public class FindCategoryServlet extends HttpServlet { 23 | private static final long serialVersionUID = 1L; 24 | 25 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 26 | 27 | try { 28 | request.getSession().removeAttribute("c1name"); 29 | 30 | NodeDateService service = new NodeDateService(); 31 | request.setCharacterEncoding("utf-8"); 32 | response.setContentType("text/html;utf-8"); 33 | String c1name = request.getParameter("name"); 34 | c1name = URLDecoder.decode(c1name, "utf-8"); 35 | 36 | 37 | request.getSession().setAttribute("c1name", c1name); 38 | NodeDate node = service.getNodeDate(c1name); 39 | 40 | //String code = node.getCode(); 41 | String code="51"; 42 | if(c1name.equals("平板")){ 43 | code="52"; 44 | }else if(c1name.equals("笔记本")){ 45 | code="53"; 46 | }else if(c1name.equals("配件")){ 47 | code="54"; 48 | } 49 | 50 | List> c2name = service.getNextName(code); 51 | 52 | request.getSession().setAttribute("c2name", c2name); 53 | response.sendRedirect("ProductFindByPageCodeServlet?code="+code); 54 | } catch (SQLException e) { 55 | // TODO Auto-generated catch block 56 | e.printStackTrace(); 57 | } 58 | } 59 | 60 | /** 61 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) 62 | */ 63 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 64 | // TODO Auto-generated method stub 65 | doGet(request, response); 66 | } 67 | 68 | } 69 | -------------------------------------------------------------------------------- /src/cn/nsu/edu/estore/web/servlet/LinkageServlet.java: -------------------------------------------------------------------------------- 1 | package cn.nsu.edu.estore.web.servlet; 2 | 3 | import java.io.IOException; 4 | import java.io.PrintWriter; 5 | import java.util.HashMap; 6 | import java.util.List; 7 | 8 | import javax.servlet.ServletException; 9 | import javax.servlet.annotation.WebServlet; 10 | import javax.servlet.http.HttpServlet; 11 | import javax.servlet.http.HttpServletRequest; 12 | import javax.servlet.http.HttpServletResponse; 13 | 14 | import cn.nsu.edu.estore.service.NodeDateService; 15 | import net.sf.json.JSONArray; 16 | 17 | /** 18 | * Servlet implementation class LinkageServlet 19 | */ 20 | @WebServlet("/LinkageServlet") 21 | public class LinkageServlet extends HttpServlet { 22 | private static final long serialVersionUID = 1L; 23 | 24 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 25 | PrintWriter out=response.getWriter(); 26 | String code = request.getParameter("levelcode"); 27 | NodeDateService service = new NodeDateService(); 28 | if (code != null && !code.equals("")) {// 有变量就要进行空判断 29 | try { 30 | List> name = service.getNextName(code); 31 | request.getSession().setAttribute("c3name", name); 32 | // 将集合对象转换成json格式---List---JsonArr字符串[{},{},{}] 33 | String aString = JSONArray.fromObject(name).toString(); 34 | out.print(aString); 35 | } catch (Exception e) { 36 | e.printStackTrace(); 37 | } 38 | } else { 39 | out.print("fail"); 40 | // 查询失败 41 | } 42 | 43 | } 44 | 45 | /** 46 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) 47 | */ 48 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 49 | // TODO Auto-generated method stub 50 | doGet(request, response); 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /src/cn/nsu/edu/estore/web/servlet/LoginOutServlet.java: -------------------------------------------------------------------------------- 1 | package cn.nsu.edu.estore.web.servlet; 2 | 3 | import java.io.IOException; 4 | import javax.servlet.ServletException; 5 | import javax.servlet.annotation.WebServlet; 6 | import javax.servlet.http.Cookie; 7 | import javax.servlet.http.HttpServlet; 8 | import javax.servlet.http.HttpServletRequest; 9 | import javax.servlet.http.HttpServletResponse; 10 | 11 | /** 12 | * Servlet implementation class LoginOutServlet 13 | */ 14 | @WebServlet("/LoginOutServlet") 15 | public class LoginOutServlet extends HttpServlet { 16 | private static final long serialVersionUID = 1L; 17 | 18 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 19 | /** 20 | * 注:*************** 21 | * 正常的cookie只能在一个应用中共享,即一个cookie只能由创建它的应用获得。 22 | * 可在同一应用服务器内共享方法:设置cookie.setPath("/"); 23 | */ 24 | // 注销功能就是销毁session 25 | 26 | request.getSession().invalidate(); 27 | 28 | // 将自动登录的cookie删除。 29 | 30 | Cookie cookie = new Cookie("autologin", ""); 31 | cookie.setMaxAge(0); 32 | cookie.setPath("/"); 33 | response.addCookie(cookie); 34 | 35 | response.sendRedirect(request.getContextPath() + "/index.jsp"); 36 | 37 | 38 | 39 | } 40 | 41 | /** 42 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) 43 | */ 44 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 45 | // TODO Auto-generated method stub 46 | doGet(request, response); 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /src/cn/nsu/edu/estore/web/servlet/LoginServlet.java: -------------------------------------------------------------------------------- 1 | package cn.nsu.edu.estore.web.servlet; 2 | 3 | import java.io.IOException; 4 | import java.lang.reflect.InvocationTargetException; 5 | import java.net.URLEncoder; 6 | import java.util.Map; 7 | 8 | import javax.servlet.ServletException; 9 | import javax.servlet.annotation.WebServlet; 10 | import javax.servlet.http.Cookie; 11 | import javax.servlet.http.HttpServlet; 12 | import javax.servlet.http.HttpServletRequest; 13 | import javax.servlet.http.HttpServletResponse; 14 | 15 | import org.apache.commons.beanutils.BeanUtils; 16 | 17 | import cn.nsu.edu.estore.domain.User; 18 | import cn.nsu.edu.estore.exception.ActiveCodeException; 19 | import cn.nsu.edu.estore.exception.LoginException; 20 | import cn.nsu.edu.estore.service.UserService; 21 | 22 | /** 23 | * Servlet implementation class LoginServlet 24 | */ 25 | @WebServlet("/LoginServlet") 26 | public class LoginServlet extends HttpServlet { 27 | private static final long serialVersionUID = 1L; 28 | 29 | /** 30 | * @see HttpServlet#HttpServlet() 31 | */ 32 | public LoginServlet() { 33 | super(); 34 | // TODO Auto-generated constructor stub 35 | } 36 | 37 | /** 38 | * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) 39 | */ 40 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 41 | // 1.得到所有请求参数,封装到User对象中. 42 | User user = new User(); 43 | 44 | String username = request.getParameter("username"); 45 | String password = request.getParameter("password"); 46 | 47 | try { 48 | BeanUtils.populate(user, request.getParameterMap()); 49 | } catch (IllegalAccessException e) { 50 | e.printStackTrace(); 51 | } catch (InvocationTargetException e) { 52 | e.printStackTrace(); 53 | } 54 | 55 | // 2.校验用户名密码数据是否为空为空, 56 | //如果用户名密码为空,即Map集合中拥有返回的错误信息,即Map的集合有大小 57 | Map map = user.validation(); 58 | 59 | if (map.size() != 0) { 60 | request.setAttribute("map", map); 61 | request.getRequestDispatcher("/home.jsp").forward(request, 62 | response); 63 | return; 64 | } 65 | 66 | 67 | // 3.调用service中登录的方法 68 | UserService service = new UserService(); 69 | try { 70 | User user1 = service.login(username, password); 71 | 72 | // 登录成功 73 | 74 | // 判断是否勾选了记住用户名. 75 | String remember = request.getParameter("remember"); 76 | if ("on".equals(remember)) { 77 | // 勾选了--考虑中文问题 78 | Cookie cookie = new Cookie("remember", URLEncoder.encode( 79 | user1.getUsername(), "utf-8")); 80 | cookie.setMaxAge(10 * 24 * 60 * 60); 81 | cookie.setPath("/"); 82 | response.addCookie(cookie); 83 | } else { 84 | // 如果用户没有勾选记住用户名,将cookie删除。删除cookie,只需要设置maxage=0或-1,注意:要与cookie的path一致. 85 | Cookie cookie = new Cookie("remember", URLEncoder.encode( 86 | user1.getUsername(), "utf-8")); 87 | cookie.setMaxAge(0); 88 | cookie.setPath("/"); 89 | response.addCookie(cookie); 90 | } 91 | 92 | // 自动登录 93 | 94 | String autologin=request.getParameter("autologin"); 95 | if("on".equals(autologin)){ 96 | Cookie cookie = new Cookie("autologin", URLEncoder.encode( 97 | user1.getUsername(), "utf-8")+"::"+password); 98 | cookie.setMaxAge(10 * 24 * 60 * 60); 99 | cookie.setPath("/"); 100 | response.addCookie(cookie); 101 | }else{ 102 | Cookie cookie = new Cookie("autologin", URLEncoder.encode( 103 | user1.getUsername(), "utf-8")+"::"+password); 104 | cookie.setMaxAge(0); 105 | cookie.setPath("/"); 106 | response.addCookie(cookie); 107 | } 108 | 109 | request.getSession().invalidate();//先销毁session。 110 | 111 | request.getSession().setAttribute("user", user1);// 登录成功,将user存储到session中. 112 | 113 | response.sendRedirect("http://localhost:8080/Estore"); // 请求转发只能在本站内跳转........登录成功应该加上用户信息******* 114 | return; 115 | 116 | } catch (ActiveCodeException e) { 117 | e.printStackTrace(); 118 | request.setAttribute("login.message", e.getMessage()); 119 | request.getRequestDispatcher("/home.jsp") 120 | .forward(request, response); 121 | return; 122 | } catch (javax.security.auth.login.LoginException e) { 123 | // TODO Auto-generated catch block 124 | e.printStackTrace(); 125 | } 126 | 127 | } 128 | 129 | /** 130 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) 131 | */ 132 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 133 | // TODO Auto-generated method stub 134 | doGet(request, response); 135 | } 136 | 137 | } 138 | -------------------------------------------------------------------------------- /src/cn/nsu/edu/estore/web/servlet/ProductAddServlet.java: -------------------------------------------------------------------------------- 1 | package cn.nsu.edu.estore.web.servlet; 2 | 3 | import java.io.File; 4 | import java.io.FileOutputStream; 5 | import java.io.IOException; 6 | import java.io.InputStream; 7 | import java.lang.reflect.InvocationTargetException; 8 | import java.sql.SQLException; 9 | import java.util.HashMap; 10 | import java.util.List; 11 | import java.util.Map; 12 | 13 | import javax.servlet.ServletException; 14 | import javax.servlet.annotation.WebServlet; 15 | import javax.servlet.http.HttpServlet; 16 | import javax.servlet.http.HttpServletRequest; 17 | import javax.servlet.http.HttpServletResponse; 18 | import javax.servlet.http.Part; 19 | 20 | import org.apache.commons.beanutils.BeanUtils; 21 | import org.apache.commons.fileupload.FileItem; 22 | import org.apache.commons.fileupload.FileUploadException; 23 | import org.apache.commons.fileupload.disk.DiskFileItemFactory; 24 | import org.apache.commons.fileupload.servlet.ServletFileUpload; 25 | 26 | import cn.nsu.edu.estore.domain.Product; 27 | import cn.nsu.edu.estore.exception.RegistException; 28 | import cn.nsu.edu.estore.service.ProductService; 29 | import cn.nsu.edu.estore.utils.Projectpath; 30 | import cn.nsu.edu.estore.utils.UploadPic; 31 | 32 | /** 33 | * Servlet implementation class Text 34 | */ 35 | @WebServlet("/ProductAddServlet") 36 | public class ProductAddServlet extends HttpServlet { 37 | private static final long serialVersionUID = 1L; 38 | 39 | /** 40 | * @see HttpServlet#HttpServlet() 41 | */ 42 | public ProductAddServlet() { 43 | super(); 44 | // TODO Auto-generated constructor stub 45 | } 46 | 47 | /** 48 | * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) 49 | */ 50 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 51 | 52 | Map map = new HashMap();// 用于封装所有请求参数 53 | 54 | DiskFileItemFactory factory = new DiskFileItemFactory(); 55 | //创建一个文件上传解析器 56 | ServletFileUpload upload = new ServletFileUpload(factory); 57 | //解决上传文件名的中文乱码 58 | upload.setHeaderEncoding("UTF-8"); 59 | //判断提交上来的数据是否是上传表单的数据 60 | if(!ServletFileUpload.isMultipartContent(request)){ 61 | return; 62 | } 63 | try { 64 | List list = upload.parseRequest(request); 65 | 66 | for(FileItem item : list){ 67 | if(item.isFormField()){ 68 | map.put(item.getFieldName(), 69 | new String[] { item.getString("utf-8") }); // 封装其它数据 70 | 71 | }else { 72 | String filename = item.getName(); 73 | if(filename==null || filename.trim().equals("")){ 74 | continue; 75 | } 76 | filename = filename.substring(filename.lastIndexOf("\\")+1); 77 | UploadPic.savePic(item,filename); 78 | 79 | map.put("imgurl", new String[] {filename}); 80 | File directory = new File("");// 参数为空 81 | String proRootPath = directory.getCanonicalPath(); 82 | System.out.println(proRootPath); 83 | } 84 | 85 | } 86 | //将所得信息赋给Product对象 87 | Product product = new Product(); 88 | //调用service中添加方法 89 | ProductService service = new ProductService(); 90 | 91 | try { 92 | BeanUtils.populate(product, map); 93 | System.out.println(product.getImgurl()); 94 | 95 | service.add(product); 96 | 97 | request.getRequestDispatcher("/ProductFindAllServlet").forward(request, response); 98 | 99 | return; 100 | } catch (SQLException e) { 101 | e.printStackTrace(); 102 | request.getSession().setAttribute("add.message", e.getMessage()); 103 | request.getRequestDispatcher("/add_product.jsp").forward(request, 104 | response); 105 | return; 106 | 107 | } catch (IllegalAccessException e) { 108 | e.printStackTrace(); 109 | } catch (InvocationTargetException e) { 110 | e.printStackTrace(); 111 | } 112 | 113 | } catch (FileUploadException e) { 114 | e.printStackTrace(); 115 | } 116 | 117 | } 118 | 119 | private boolean isPicture(String fileName) { 120 | String[] exts = {"jpg","bmp","png","jpeg","gif"}; 121 | String ext = fileName.substring(fileName.lastIndexOf(".")+1, fileName.length()); 122 | for (int i = 0; i < exts.length; i++) { 123 | if (ext.toLowerCase().equals(exts[i])) { 124 | return true; 125 | } 126 | } 127 | return false; 128 | } 129 | 130 | /** 131 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) 132 | */ 133 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 134 | // TODO Auto-generated method stub 135 | doGet(request, response); 136 | } 137 | 138 | } 139 | -------------------------------------------------------------------------------- /src/cn/nsu/edu/estore/web/servlet/ProductDelByIdServlet.java: -------------------------------------------------------------------------------- 1 | package cn.nsu.edu.estore.web.servlet; 2 | 3 | import java.io.IOException; 4 | import java.sql.SQLException; 5 | 6 | import javax.servlet.ServletException; 7 | import javax.servlet.annotation.WebServlet; 8 | import javax.servlet.http.HttpServlet; 9 | import javax.servlet.http.HttpServletRequest; 10 | import javax.servlet.http.HttpServletResponse; 11 | 12 | import cn.nsu.edu.estore.service.ProductService; 13 | 14 | /** 15 | * Servlet implementation class ProductDelByIdServlet 16 | */ 17 | @WebServlet("/ProductDelByIdServlet") 18 | public class ProductDelByIdServlet extends HttpServlet { 19 | private static final long serialVersionUID = 1L; 20 | 21 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 22 | //获取所传id值 23 | int id = Integer.parseInt(request.getParameter("id")); 24 | 25 | //调用service中删除操作 26 | ProductService service = new ProductService(); 27 | 28 | try { 29 | service.delete(id); 30 | 31 | request.getRequestDispatcher("/ProductFindAllServlet").forward(request, response); 32 | return; 33 | } catch (SQLException e) { 34 | // TODO Auto-generated catch block 35 | e.printStackTrace(); 36 | } 37 | 38 | } 39 | 40 | /** 41 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) 42 | */ 43 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 44 | // TODO Auto-generated method stub 45 | doGet(request, response); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /src/cn/nsu/edu/estore/web/servlet/ProductDelSelectServlet.java: -------------------------------------------------------------------------------- 1 | package cn.nsu.edu.estore.web.servlet; 2 | 3 | import java.io.IOException; 4 | import java.sql.SQLException; 5 | 6 | import javax.servlet.ServletException; 7 | import javax.servlet.annotation.WebServlet; 8 | import javax.servlet.http.HttpServlet; 9 | import javax.servlet.http.HttpServletRequest; 10 | import javax.servlet.http.HttpServletResponse; 11 | 12 | import cn.nsu.edu.estore.service.ProductService; 13 | 14 | /** 15 | * Servlet implementation class ProductDelSelectServlet 16 | */ 17 | @WebServlet("/ProductDelSelectServlet") 18 | public class ProductDelSelectServlet extends HttpServlet { 19 | private static final long serialVersionUID = 1L; 20 | 21 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 22 | //得到删除所有商品id 23 | String[] idstring = (request.getParameterValues("ck")); 24 | 25 | //将String类型数组转化成int类型数组 26 | int[] id = new int[idstring.length]; 27 | for (int i = 0; i < id.length; i++) { 28 | id[i] = Integer.parseInt(idstring[i]); 29 | } 30 | 31 | //调用service中删除所选数据 32 | ProductService service = new ProductService(); 33 | 34 | try { 35 | service.delSelect(id); 36 | 37 | request.getRequestDispatcher("/ProductFindAllServlet").forward(request, response); 38 | return; 39 | } catch (SQLException e) { 40 | // TODO Auto-generated catch block 41 | e.printStackTrace(); 42 | } 43 | } 44 | 45 | /** 46 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) 47 | */ 48 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 49 | // TODO Auto-generated method stub 50 | doGet(request, response); 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /src/cn/nsu/edu/estore/web/servlet/ProductFindAllServlet.java: -------------------------------------------------------------------------------- 1 | package cn.nsu.edu.estore.web.servlet; 2 | 3 | import java.io.IOException; 4 | import java.sql.SQLException; 5 | import java.util.List; 6 | 7 | import javax.servlet.ServletException; 8 | import javax.servlet.annotation.WebServlet; 9 | import javax.servlet.http.HttpServlet; 10 | import javax.servlet.http.HttpServletRequest; 11 | import javax.servlet.http.HttpServletResponse; 12 | 13 | import cn.nsu.edu.estore.domain.Product; 14 | import cn.nsu.edu.estore.domain.User; 15 | import cn.nsu.edu.estore.service.ProductService; 16 | 17 | /** 18 | * Servlet implementation class ProductFindAllServlet 19 | */ 20 | @WebServlet("/ProductFindAllServlet") 21 | public class ProductFindAllServlet extends HttpServlet { 22 | private static final long serialVersionUID = 1L; 23 | 24 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 25 | //调用service中查询所有方法 26 | ProductService service = new ProductService(); 27 | 28 | try { 29 | List pro = service.findAll(); 30 | 31 | request.setAttribute("pro", pro); 32 | 33 | List pro1 = service.findByCode("51"); 34 | 35 | request.setAttribute("pro1", pro1); 36 | 37 | List pro2 = service.findByCode("52"); 38 | 39 | request.setAttribute("pro2", pro2); 40 | 41 | List pro3 = service.findByCode("53"); 42 | 43 | request.setAttribute("pro3", pro3); 44 | 45 | List pro4 = service.findByCode("54"); 46 | 47 | request.setAttribute("pro4", pro4); 48 | 49 | User user = (User) request.getSession().getAttribute("user"); 50 | 51 | if (user == null || user.getRole().equals("user")) { 52 | request.getRequestDispatcher("/home.jsp").forward(request, response); 53 | return; 54 | } 55 | request.getRequestDispatcher("/showProducts.jsp").forward(request, response); 56 | return; 57 | 58 | } catch (SQLException e) { 59 | e.printStackTrace(); 60 | response.getWriter().write(e.getMessage()); 61 | return; 62 | } 63 | } 64 | 65 | /** 66 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) 67 | */ 68 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 69 | // TODO Auto-generated method stub 70 | doGet(request, response); 71 | } 72 | 73 | } 74 | -------------------------------------------------------------------------------- /src/cn/nsu/edu/estore/web/servlet/ProductFindByIdServlet.java: -------------------------------------------------------------------------------- 1 | package cn.nsu.edu.estore.web.servlet; 2 | 3 | import java.io.IOException; 4 | import java.sql.SQLException; 5 | 6 | import javax.servlet.ServletException; 7 | import javax.servlet.annotation.WebServlet; 8 | import javax.servlet.http.HttpServlet; 9 | import javax.servlet.http.HttpServletRequest; 10 | import javax.servlet.http.HttpServletResponse; 11 | 12 | import cn.nsu.edu.estore.domain.Product; 13 | import cn.nsu.edu.estore.domain.User; 14 | import cn.nsu.edu.estore.service.ProductService; 15 | 16 | /** 17 | * Servlet implementation class ProductFindByIdServlet 18 | */ 19 | @WebServlet("/ProductFindByIdServlet") 20 | public class ProductFindByIdServlet extends HttpServlet { 21 | private static final long serialVersionUID = 1L; 22 | 23 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 24 | //获取输入信息 25 | String id = request.getParameter("id"); 26 | 27 | //调用service中查询所有方法 28 | ProductService service = new ProductService(); 29 | 30 | try { 31 | Product pro = service.findById(Integer.parseInt(id)); 32 | 33 | request.getSession().setAttribute("pro", pro); 34 | 35 | User user = (User) request.getSession().getAttribute("user"); 36 | 37 | if (user == null || user.getRole().equals("user")) { 38 | request.getRequestDispatcher("/productInfo_user.jsp").forward(request, response); 39 | return; 40 | } 41 | request.getRequestDispatcher("/productInfo_admin.jsp").forward(request, response); 42 | return; 43 | 44 | } catch (SQLException e) { 45 | e.printStackTrace(); 46 | response.getWriter().write(e.getMessage()); 47 | return; 48 | } 49 | } 50 | 51 | /** 52 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) 53 | */ 54 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 55 | // TODO Auto-generated method stub 56 | doGet(request, response); 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /src/cn/nsu/edu/estore/web/servlet/ProductFindByPageCodeServlet.java: -------------------------------------------------------------------------------- 1 | package cn.nsu.edu.estore.web.servlet; 2 | 3 | import java.io.IOException; 4 | import javax.servlet.ServletException; 5 | import javax.servlet.annotation.WebServlet; 6 | import javax.servlet.http.HttpServlet; 7 | import javax.servlet.http.HttpServletRequest; 8 | import javax.servlet.http.HttpServletResponse; 9 | 10 | import cn.nsu.edu.estore.domain.PageBean; 11 | import cn.nsu.edu.estore.service.ProductService; 12 | 13 | /** 14 | * Servlet implementation class ProductFindByPageCodeServlet 15 | */ 16 | @WebServlet("/ProductFindByPageCodeServlet") 17 | public class ProductFindByPageCodeServlet extends HttpServlet { 18 | private static final long serialVersionUID = 1L; 19 | 20 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 21 | int pageNum = 1; 22 | // String code = (String) request.getSession().getAttribute("code111"); 23 | String code = request.getParameter("code"); 24 | String _pageNum = request.getParameter("pageNum"); 25 | if (code != null) { 26 | request.getSession().setAttribute("code", code); 27 | if (_pageNum != null) { 28 | pageNum = Integer.parseInt(_pageNum); 29 | } 30 | 31 | //规定每页显示条数 32 | int currentPage = 12; 33 | String _currentPage = request.getParameter("currentPage"); 34 | if (_currentPage != null) { 35 | currentPage = Integer.parseInt(_currentPage); 36 | } 37 | 38 | //调用service中查询操作 39 | ProductService service = new ProductService(); 40 | 41 | PageBean pb = service.findByPageByCode(pageNum, currentPage, code); 42 | 43 | request.setAttribute("pb1", pb); 44 | 45 | request.getRequestDispatcher("/product.jsp").forward( 46 | request, response); 47 | return; 48 | } 49 | if (_pageNum != null) { 50 | pageNum = Integer.parseInt(_pageNum); 51 | } 52 | 53 | //规定每页显示条数 54 | int currentPage = 12; 55 | String _currentPage = request.getParameter("currentPage"); 56 | if (_currentPage != null) { 57 | currentPage = Integer.parseInt(_currentPage); 58 | } 59 | 60 | //调用service中查询操作 61 | ProductService service = new ProductService(); 62 | PageBean pb = service.findByPageByCode(pageNum, currentPage, (String)request.getSession().getAttribute("code")); 63 | request.removeAttribute("pb1"); 64 | request.setAttribute("pb1", pb); 65 | request.getRequestDispatcher("/product.jsp").forward(request, response); 66 | return; 67 | 68 | 69 | } 70 | 71 | /** 72 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) 73 | */ 74 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 75 | // TODO Auto-generated method stub 76 | doGet(request, response); 77 | } 78 | 79 | } 80 | -------------------------------------------------------------------------------- /src/cn/nsu/edu/estore/web/servlet/ProductFindByPageServlet.java: -------------------------------------------------------------------------------- 1 | package cn.nsu.edu.estore.web.servlet; 2 | 3 | import java.io.IOException; 4 | import java.sql.SQLException; 5 | 6 | import javax.servlet.ServletException; 7 | import javax.servlet.annotation.WebServlet; 8 | import javax.servlet.http.HttpServlet; 9 | import javax.servlet.http.HttpServletRequest; 10 | import javax.servlet.http.HttpServletResponse; 11 | 12 | import cn.nsu.edu.estore.domain.PageBean; 13 | import cn.nsu.edu.estore.exception.RegistException; 14 | import cn.nsu.edu.estore.service.ProductService; 15 | 16 | /** 17 | * Servlet implementation class ProductFindByPageServlet 18 | */ 19 | @WebServlet("/ProductFindByPageServlet") 20 | public class ProductFindByPageServlet extends HttpServlet { 21 | private static final long serialVersionUID = 1L; 22 | 23 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 24 | //设置默认访问第一页 25 | int pageNum = 1; 26 | 27 | String _pageNum = request.getParameter("pageNum"); 28 | if (_pageNum != null) { 29 | pageNum = Integer.parseInt(_pageNum); 30 | } 31 | 32 | //规定每页显示条数 33 | int currentPage = 12; 34 | String _currentPage = request.getParameter("currentPage"); 35 | if (_currentPage != null) { 36 | currentPage = Integer.parseInt(_currentPage); 37 | } 38 | 39 | //调用service中查询操作 40 | ProductService service = new ProductService(); 41 | 42 | PageBean pb = service.findByPage(pageNum, currentPage); 43 | 44 | request.setAttribute("pb", pb); 45 | 46 | request.getRequestDispatcher("/home.jsp").forward( 47 | request, response); 48 | 49 | return; 50 | 51 | } 52 | 53 | /** 54 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) 55 | */ 56 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 57 | // TODO Auto-generated method stub 58 | doGet(request, response); 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /src/cn/nsu/edu/estore/web/servlet/ProductSimpleServlet.java: -------------------------------------------------------------------------------- 1 | package cn.nsu.edu.estore.web.servlet; 2 | 3 | import java.io.IOException; 4 | import java.sql.SQLException; 5 | import java.util.List; 6 | 7 | import javax.servlet.ServletException; 8 | import javax.servlet.annotation.WebServlet; 9 | import javax.servlet.http.HttpServlet; 10 | import javax.servlet.http.HttpServletRequest; 11 | import javax.servlet.http.HttpServletResponse; 12 | 13 | import cn.nsu.edu.estore.domain.Product; 14 | import cn.nsu.edu.estore.exception.RegistException; 15 | import cn.nsu.edu.estore.service.ProductService; 16 | 17 | /** 18 | * Servlet implementation class ProductmmServlet 19 | */ 20 | @WebServlet("/ProductSimpleServlet") 21 | public class ProductSimpleServlet extends HttpServlet { 22 | private static final long serialVersionUID = 1L; 23 | 24 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 25 | //得到请求参数 26 | String field = request.getParameter("field"); // 字段名称 27 | String msg = request.getParameter("msg"); // 字段值 28 | 29 | //调用service查询操作 30 | ProductService service = new ProductService(); 31 | 32 | try { 33 | List pro = service.simpleSelect(field, msg); 34 | 35 | request.setAttribute("pro", pro); 36 | 37 | request.getRequestDispatcher("/showProducts.jsp").forward(request, 38 | response); 39 | return; 40 | 41 | } catch (SQLException e) { 42 | e.printStackTrace(); 43 | response.getWriter().write(e.getMessage()); 44 | return; 45 | } 46 | } 47 | 48 | /** 49 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) 50 | */ 51 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 52 | // TODO Auto-generated method stub 53 | doGet(request, response); 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /src/cn/nsu/edu/estore/web/servlet/ProductUpdateServlet.java: -------------------------------------------------------------------------------- 1 | package cn.nsu.edu.estore.web.servlet; 2 | 3 | import java.io.FileOutputStream; 4 | import java.io.IOException; 5 | import java.io.InputStream; 6 | import java.lang.reflect.InvocationTargetException; 7 | import java.sql.SQLException; 8 | import java.util.HashMap; 9 | import java.util.List; 10 | import java.util.Map; 11 | 12 | import javax.servlet.ServletException; 13 | import javax.servlet.annotation.WebServlet; 14 | import javax.servlet.http.HttpServlet; 15 | import javax.servlet.http.HttpServletRequest; 16 | import javax.servlet.http.HttpServletResponse; 17 | 18 | import org.apache.commons.beanutils.BeanUtils; 19 | import org.apache.commons.beanutils.ConvertUtils; 20 | import org.apache.commons.beanutils.converters.DateConverter; 21 | import org.apache.commons.fileupload.FileItem; 22 | import org.apache.commons.fileupload.FileUploadException; 23 | import org.apache.commons.fileupload.disk.DiskFileItemFactory; 24 | import org.apache.commons.fileupload.servlet.ServletFileUpload; 25 | 26 | import cn.nsu.edu.estore.domain.Product; 27 | import cn.nsu.edu.estore.service.ProductService; 28 | import cn.nsu.edu.estore.utils.UploadPic; 29 | 30 | 31 | /** 32 | * Servlet implementation class ProductUpdateServlet 33 | */ 34 | @WebServlet("/ProductUpdateServlet") 35 | public class ProductUpdateServlet extends HttpServlet { 36 | private static final long serialVersionUID = 1L; 37 | 38 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 39 | 40 | Map map = new HashMap();// 用于封装所有请求参数 41 | 42 | DiskFileItemFactory factory = new DiskFileItemFactory(); 43 | //创建一个文件上传解析器 44 | ServletFileUpload upload = new ServletFileUpload(factory); 45 | //解决上传文件名的中文乱码 46 | upload.setHeaderEncoding("UTF-8"); 47 | 48 | //判断提交上来的数据是否是上传表单的数据 49 | if(!ServletFileUpload.isMultipartContent(request)){ 50 | return; 51 | } 52 | try { 53 | List list = upload.parseRequest(request); 54 | 55 | for(FileItem item : list){ 56 | if(item.isFormField()){ 57 | map.put(item.getFieldName(), 58 | new String[] { item.getString("utf-8") }); // 封装其它数据 59 | 60 | }else { 61 | String filename = item.getName(); 62 | if(filename==null || filename.trim().equals("")){ 63 | continue; 64 | } 65 | filename = filename.substring(filename.lastIndexOf("\\")+1); 66 | 67 | //调用图片上传方法 68 | UploadPic.savePic(item, filename); 69 | 70 | //将文件名封装 71 | map.put("imgurl", new String[] {filename}); 72 | } 73 | 74 | } 75 | //将所得信息赋给Product对象 76 | Product product = new Product(); 77 | 78 | //调用service中添加方法 79 | ProductService service = new ProductService(); 80 | 81 | try { 82 | BeanUtils.populate(product, map); 83 | service.update(product); 84 | 85 | request.getRequestDispatcher("/ProductFindAllServlet").forward(request, response); 86 | return; 87 | } catch (SQLException e) { 88 | e.printStackTrace(); 89 | request.getSession().setAttribute("add.message", e.getMessage()); 90 | request.getRequestDispatcher("/add_product.jsp").forward(request, 91 | response); 92 | return; 93 | 94 | } catch (IllegalAccessException e) { 95 | // TODO Auto-generated catch block 96 | e.printStackTrace(); 97 | } catch (InvocationTargetException e) { 98 | // TODO Auto-generated catch block 99 | e.printStackTrace(); 100 | } 101 | 102 | } catch (FileUploadException e) { 103 | // TODO Auto-generated catch block 104 | e.printStackTrace(); 105 | } 106 | 107 | } 108 | 109 | /** 110 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) 111 | */ 112 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 113 | // TODO Auto-generated method stub 114 | doGet(request, response); 115 | } 116 | 117 | } 118 | -------------------------------------------------------------------------------- /src/cn/nsu/edu/estore/web/servlet/RegistServlet.java: -------------------------------------------------------------------------------- 1 | package cn.nsu.edu.estore.web.servlet; 2 | 3 | import java.io.IOException; 4 | import java.lang.reflect.InvocationTargetException; 5 | 6 | import javax.servlet.ServletException; 7 | import javax.servlet.annotation.WebServlet; 8 | import javax.servlet.http.HttpServlet; 9 | import javax.servlet.http.HttpServletRequest; 10 | import javax.servlet.http.HttpServletResponse; 11 | 12 | import org.apache.commons.beanutils.BeanUtils; 13 | 14 | import cn.nsu.edu.estore.domain.User; 15 | import cn.nsu.edu.estore.exception.RegistException; 16 | import cn.nsu.edu.estore.service.UserService; 17 | import cn.nsu.edu.estore.utils.ActiveCodeUtils; 18 | 19 | 20 | @WebServlet("/RegistServlet") 21 | public class RegistServlet extends HttpServlet { 22 | private static final long serialVersionUID = 1L; 23 | 24 | public void doPost(HttpServletRequest request, HttpServletResponse response) 25 | throws ServletException, IOException { 26 | /*1.进行验证码判断 START */ 27 | //验证服务器端生成的验证码与客户端验证码进行校验,验证用户请求是否合法。 28 | /* String checkCode = request.getParameter("checkcode"); 29 | 30 | String _checkCode = (String) request.getSession().getAttribute( 31 | "checkcode_session"); 32 | request.getSession().removeAttribute("checkcode_session");//从session中删除。 33 | 34 | if (!checkCode.equals(_checkCode)) { 35 | request.setAttribute("regist.message", "验证码不正确"); 36 | request.getRequestDispatcher("/regist.jsp").forward(request, 37 | response); 38 | return; 39 | }*/ //***********验证码确认BUG****************** 40 | /*1.进行验证码判断 END */ 41 | // request.setCharacterEncoding("utf-8"); 42 | 43 | /* 2.得到所有请求参数,封装到User对象中. START*/ 44 | User user = new User(); 45 | try { 46 | BeanUtils.populate(user, request.getParameterMap()); 47 | } catch (IllegalAccessException e) { 48 | e.printStackTrace(); 49 | } catch (InvocationTargetException e) { 50 | e.printStackTrace(); 51 | } 52 | /* 2.得到所有请求参数,封装到User对象中. END*/ 53 | 54 | // 手动封装激活码 55 | user.setActivecode(ActiveCodeUtils.getActiveCode()); 56 | 57 | /* 3.调用service完成注册操作. START*/ 58 | UserService service = new UserService(); 59 | try { 60 | service.regist(user); 61 | 62 | // 3.1注册成功 63 | response.sendRedirect(request.getContextPath() 64 | + "/regist_success.jsp"); 65 | return; 66 | } catch (RegistException e) { 67 | // 3.2注册失败 68 | request.setAttribute("regist.message", e.getMessage()); 69 | request.getRequestDispatcher("/error/registuser_error.jsp").forward(request, 70 | response); 71 | return; 72 | } 73 | /* 3.调用service完成注册操作. END*/ 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /src/cn/nsu/edu/estore/web/servlet/RemoveProductFromCartServlet.java: -------------------------------------------------------------------------------- 1 | package cn.nsu.edu.estore.web.servlet; 2 | 3 | import java.io.IOException; 4 | import java.sql.SQLException; 5 | import java.util.Map; 6 | 7 | import javax.servlet.ServletException; 8 | import javax.servlet.annotation.WebServlet; 9 | import javax.servlet.http.HttpServlet; 10 | import javax.servlet.http.HttpServletRequest; 11 | import javax.servlet.http.HttpServletResponse; 12 | 13 | import cn.nsu.edu.estore.domain.Product; 14 | import cn.nsu.edu.estore.service.ProductService; 15 | 16 | /** 17 | * Servlet implementation class RemoveProductFromCartServlet 18 | */ 19 | @WebServlet("/RemoveProductFromCartServlet") 20 | public class RemoveProductFromCartServlet extends HttpServlet { 21 | private static final long serialVersionUID = 1L; 22 | 23 | 24 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 25 | // 得到要删除的商品的id 26 | int id =Integer.parseInt( request.getParameter("id")); 27 | // 得到购物车,从购物车中将商品删除, 28 | Map cart = (Map) request 29 | .getSession().getAttribute("cart"); 30 | 31 | 32 | Product p=new Product(); 33 | p.setId(id); 34 | 35 | cart.remove(p); 36 | //如果购物车中无商品,将购物车删除。 37 | if (cart.size() == 0) { 38 | request.getSession().removeAttribute("cart"); 39 | } 40 | response.sendRedirect(request.getContextPath() + "/showcart.jsp"); 41 | } 42 | 43 | /** 44 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) 45 | */ 46 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 47 | // TODO Auto-generated method stub 48 | doGet(request, response); 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /src/cn/nsu/edu/estore/web/servlet/RemoveSelectProductFromCartServlet.java: -------------------------------------------------------------------------------- 1 | package cn.nsu.edu.estore.web.servlet; 2 | 3 | import java.io.IOException; 4 | import java.util.Map; 5 | 6 | import javax.servlet.ServletException; 7 | import javax.servlet.annotation.WebServlet; 8 | import javax.servlet.http.HttpServlet; 9 | import javax.servlet.http.HttpServletRequest; 10 | import javax.servlet.http.HttpServletResponse; 11 | 12 | import cn.nsu.edu.estore.domain.Product; 13 | 14 | /** 15 | * Servlet implementation class RemoveSelectProductFromCartServlet 16 | */ 17 | @WebServlet("/RemoveSelectProductFromCartServlet") 18 | public class RemoveSelectProductFromCartServlet extends HttpServlet { 19 | private static final long serialVersionUID = 1L; 20 | 21 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 22 | String[] id = request.getParameterValues("id"); 23 | 24 | Map cart = (Map) request 25 | .getSession().getAttribute("cart"); 26 | 27 | for (int i = 0; i < id.length; i++) { 28 | Product p = new Product(); 29 | p.setId(Integer.parseInt(id[i])); 30 | cart.remove(p); 31 | } 32 | 33 | response.sendRedirect(request.getContextPath() + "/showcart.jsp"); 34 | } 35 | 36 | /** 37 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) 38 | */ 39 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 40 | // TODO Auto-generated method stub 41 | doGet(request, response); 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/cn/nsu/edu/estore/web/servlet/UserActiveServlet.java: -------------------------------------------------------------------------------- 1 | package cn.nsu.edu.estore.web.servlet; 2 | 3 | import java.io.IOException; 4 | import javax.servlet.ServletException; 5 | import javax.servlet.annotation.WebServlet; 6 | import javax.servlet.http.HttpServlet; 7 | import javax.servlet.http.HttpServletRequest; 8 | import javax.servlet.http.HttpServletResponse; 9 | 10 | import cn.nsu.edu.estore.exception.ActiveCodeException; 11 | import cn.nsu.edu.estore.service.UserService; 12 | 13 | /** 14 | * Servlet implementation class UserActiveServlet 15 | */ 16 | @WebServlet("/UserActiveServlet") 17 | public class UserActiveServlet extends HttpServlet { 18 | private static final long serialVersionUID = 1L; 19 | 20 | /** 21 | * @see HttpServlet#HttpServlet() 22 | */ 23 | public UserActiveServlet() { 24 | super(); 25 | // TODO Auto-generated constructor stub 26 | } 27 | 28 | /** 29 | * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) 30 | */ 31 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 32 | // 1.得到激活码 33 | String activeCode = request.getParameter("activeCode"); 34 | 35 | // 2.调用service中激活操作 36 | UserService service = new UserService(); 37 | 38 | try { 39 | service.activeUser(activeCode); 40 | 41 | response.getWriter().write( 42 | "激活成功,请回首页"); 43 | return; 44 | 45 | } catch (ActiveCodeException e) { 46 | //2.1激活码超时或者激活失败 47 | request.setAttribute("active.message", e.getMessage()); 48 | request.getRequestDispatcher("。。/error/activeuser_error.jsp").forward(request, 49 | response); 50 | return; 51 | } 52 | } 53 | 54 | /** 55 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) 56 | */ 57 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 58 | // TODO Auto-generated method stub 59 | doGet(request, response); 60 | } 61 | 62 | } 63 | -------------------------------------------------------------------------------- /upload.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/upload.zip -------------------------------------------------------------------------------- /upload/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/upload/1.png -------------------------------------------------------------------------------- /upload/10.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/upload/10.jpg -------------------------------------------------------------------------------- /upload/11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/upload/11.png -------------------------------------------------------------------------------- /upload/12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/upload/12.png -------------------------------------------------------------------------------- /upload/13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/upload/13.png -------------------------------------------------------------------------------- /upload/14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/upload/14.png -------------------------------------------------------------------------------- /upload/15.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/upload/15.jpg -------------------------------------------------------------------------------- /upload/16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/upload/16.png -------------------------------------------------------------------------------- /upload/17.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/upload/17.jpg -------------------------------------------------------------------------------- /upload/18.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/upload/18.jpg -------------------------------------------------------------------------------- /upload/19.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/upload/19.png -------------------------------------------------------------------------------- /upload/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/upload/2.png -------------------------------------------------------------------------------- /upload/20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/upload/20.png -------------------------------------------------------------------------------- /upload/21.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/upload/21.png -------------------------------------------------------------------------------- /upload/22.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/upload/22.jpg -------------------------------------------------------------------------------- /upload/23.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/upload/23.jpg -------------------------------------------------------------------------------- /upload/25.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/upload/25.jpg -------------------------------------------------------------------------------- /upload/26.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/upload/26.png -------------------------------------------------------------------------------- /upload/27.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/upload/27.png -------------------------------------------------------------------------------- /upload/28.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/upload/28.jpg -------------------------------------------------------------------------------- /upload/29.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/upload/29.png -------------------------------------------------------------------------------- /upload/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/upload/3.png -------------------------------------------------------------------------------- /upload/30.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/upload/30.png -------------------------------------------------------------------------------- /upload/31.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/upload/31.jpg -------------------------------------------------------------------------------- /upload/32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/upload/32.png -------------------------------------------------------------------------------- /upload/33.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/upload/33.png -------------------------------------------------------------------------------- /upload/34.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/upload/34.png -------------------------------------------------------------------------------- /upload/35.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/upload/35.png -------------------------------------------------------------------------------- /upload/36.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/upload/36.jpg -------------------------------------------------------------------------------- /upload/37.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/upload/37.jpg -------------------------------------------------------------------------------- /upload/38.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/upload/38.png -------------------------------------------------------------------------------- /upload/39.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/upload/39.png -------------------------------------------------------------------------------- /upload/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/upload/4.png -------------------------------------------------------------------------------- /upload/40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/upload/40.png -------------------------------------------------------------------------------- /upload/41.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/upload/41.png -------------------------------------------------------------------------------- /upload/42.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/upload/42.png -------------------------------------------------------------------------------- /upload/43.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/upload/43.png -------------------------------------------------------------------------------- /upload/44.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/upload/44.jpg -------------------------------------------------------------------------------- /upload/45.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/upload/45.jpg -------------------------------------------------------------------------------- /upload/46.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/upload/46.jpg -------------------------------------------------------------------------------- /upload/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/upload/5.png -------------------------------------------------------------------------------- /upload/6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/upload/6.jpg -------------------------------------------------------------------------------- /upload/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/upload/6.png -------------------------------------------------------------------------------- /upload/7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/upload/7.jpg -------------------------------------------------------------------------------- /upload/8.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/upload/8.jpg -------------------------------------------------------------------------------- /upload/9.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/upload/9.jpg -------------------------------------------------------------------------------- /upload/yy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/upload/yy.png -------------------------------------------------------------------------------- /web/CategoryJS/onloada.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | */ 4 | function select_onelevel(){ 5 | var ss = document.getElementById("onelevel"); 6 | var onelevelcode = ss.value; 7 | if(!onelevelcode)return; // 声明变量就要判断是否为null 8 | $.ajax({ 9 | type:"post",//请求方式get/post 10 | url:"LinkageServlet",//请求对应的地址 11 | data:{"levelcode":onelevelcode},//往服务器传递的参数, 12 | success:function(data){//服务器交互成功调用的回调函数,data就是服务器端传递出来的数据 13 | var jdata = data.trim(); // 去前后空格 14 | if(jdata=="fail"){ 15 | alert("查询失败!"); 16 | }else{ 17 | var json = eval(jdata);//将json字符串对象转化成json 18 | var sel = document.getElementById('twolevel'); 19 | if(json=='null'){ 20 | sel.options.length = 1; 21 | }else{ 22 | sel.options.length = 0; 23 | 24 | for(var i=0; i"+json[i].name+""; 77 | } 78 | document.getElementById(obj).innerHTML=dd; 79 | } 80 | } 81 | }); 82 | } -------------------------------------------------------------------------------- /web/WEB-INF/lib/c3p0-0.9.1.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/web/WEB-INF/lib/c3p0-0.9.1.2.jar -------------------------------------------------------------------------------- /web/WEB-INF/lib/commons-beanutils-1.8.3.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/web/WEB-INF/lib/commons-beanutils-1.8.3.jar -------------------------------------------------------------------------------- /web/WEB-INF/lib/commons-collections-3.2.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/web/WEB-INF/lib/commons-collections-3.2.1.jar -------------------------------------------------------------------------------- /web/WEB-INF/lib/commons-dbutils-1.4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/web/WEB-INF/lib/commons-dbutils-1.4.jar -------------------------------------------------------------------------------- /web/WEB-INF/lib/commons-fileupload-1.2.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/web/WEB-INF/lib/commons-fileupload-1.2.1.jar -------------------------------------------------------------------------------- /web/WEB-INF/lib/commons-io-1.4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/web/WEB-INF/lib/commons-io-1.4.jar -------------------------------------------------------------------------------- /web/WEB-INF/lib/commons-lang-2.6.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/web/WEB-INF/lib/commons-lang-2.6.jar -------------------------------------------------------------------------------- /web/WEB-INF/lib/commons-logging-1.1.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/web/WEB-INF/lib/commons-logging-1.1.1.jar -------------------------------------------------------------------------------- /web/WEB-INF/lib/ezmorph-1.0.6.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/web/WEB-INF/lib/ezmorph-1.0.6.jar -------------------------------------------------------------------------------- /web/WEB-INF/lib/json-lib-2.4-jdk15.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/web/WEB-INF/lib/json-lib-2.4-jdk15.jar -------------------------------------------------------------------------------- /web/WEB-INF/lib/jstl.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/web/WEB-INF/lib/jstl.jar -------------------------------------------------------------------------------- /web/WEB-INF/lib/mail.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/web/WEB-INF/lib/mail.jar -------------------------------------------------------------------------------- /web/WEB-INF/lib/mysql-connector-java-5.1.47.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/web/WEB-INF/lib/mysql-connector-java-5.1.47.jar -------------------------------------------------------------------------------- /web/WEB-INF/lib/standard.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/web/WEB-INF/lib/standard.jar -------------------------------------------------------------------------------- /web/WEB-INF/new_words.txt: -------------------------------------------------------------------------------- 1 | 一唱一和 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 | 千虑一失 55 | 千篇一律 56 | 万水千山 57 | 万无一失 58 | 万众一心 59 | 万紫千红 60 | 万死一生 61 | 推心置腹 62 | 肝胆相照 63 | 情同手足 64 | 志同道合 65 | 风雨同舟 66 | 荣辱与共 67 | 同甘共苦 68 | 关怀备注 69 | 心心相印 70 | 海誓山盟 71 | 拔刀相助 72 | 亲密无间 73 | 万紫千红 74 | 春暖花开 75 | 鸟语花香 76 | 姹紫嫣红 77 | 花红柳绿 78 | 百花争艳 79 | 锦上添花 80 | 火树银花 81 | 昨日黄花 82 | 春花秋月 83 | 过时黄花 84 | 花团锦簇 85 | 花枝招展 86 | 崇山峻岭 87 | 山明水秀 88 | 山穷水尽 89 | 大好山河 90 | 刀山火海 91 | 地动山摇 92 | 高山深涧 93 | 悬崖峭壁 94 | 峰峦雄伟 95 | 漫山遍野 96 | 江山如画 97 | 锦绣山河 98 | 五彩缤纷 99 | 五颜六色 100 | 一碧千里 101 | 万紫千红 102 | 花红柳绿 103 | 翠色欲流 104 | 姹紫嫣红 105 | 五光十色 106 | 青红皂白 107 | 绿水青山 108 | 不可多得 109 | 凤毛麟角 110 | 九牛一毛 111 | 绝无仅有 112 | 空前绝后 113 | 寥寥无几 114 | 寥若晨星 115 | 宁缺毋滥 116 | 前所未有 117 | 屈指可数 118 | 三三两两 119 | 铁树开花 120 | 微乎其微 121 | 一麟半爪 122 | 一丝一毫 123 | 百里挑一 124 | 沧海一粟 125 | 千古绝唱 126 | 摩肩接踵 127 | 车水马龙 128 | 川流不息 129 | 纷至沓来 130 | 花花世界 131 | 举袖为云 132 | 挥汗如雨 133 | 络绎不绝 134 | 门庭若市 135 | 万人空巷 136 | 水泄不通 137 | 人声鼎沸 138 | 人欢马叫 139 | 人山人海 140 | 震耳欲聋 141 | 座无虚席 142 | 包罗万象 143 | 琳琅满目 144 | 美不胜收 145 | 目不暇接 146 | 无奇不有 147 | 无穷无尽 148 | 无所不包 149 | 五花八门 150 | 眼花缭乱 151 | 洋洋大观 152 | 一应俱全 153 | 应有尽有 154 | 应接不暇 155 | 比比皆是 156 | 不可计数 157 | 层出不穷 158 | 绰绰有余 159 | 多多益善 160 | 多如牛毛 161 | 俯拾皆市 162 | 举不胜举 163 | 漫山遍野 164 | 星罗棋布 165 | 丰富多彩 166 | 九霄云外 167 | 腾云驾雾 168 | 壮志凌云 169 | 风云变幻 170 | 风起云涌 171 | 行云流水 172 | 风卷残云 173 | 浮云蔽日 174 | 孤云野鹤 175 | 烘云托月 176 | 过眼云烟 177 | 烟消云散 178 | 大雨倾盆 179 | 血雨腥风 180 | 风雨交加 181 | 风调雨顺 182 | 枪林弹雨 183 | 风雨同舟 184 | 风雨无阻 185 | 和风细雨 186 | 狂风暴雨 187 | 满城风雨 188 | 滂沱大雨 189 | 春风化雨 190 | 风雨飘摇 191 | 斜风细雨 192 | 未雨绸缪 193 | 水流湍急 194 | 水平如镜 195 | 高山流水 196 | 千山万水 197 | 水滴石穿 198 | 水乳交融 199 | 滴水不漏 200 | 杯水车薪 201 | 洪水猛兽 202 | 流水无情 203 | 直言不讳 204 | 无所顾忌 205 | 拐弯抹角 206 | 真心诚意 207 | 故弄玄虚 208 | 侃侃而谈 209 | 滔滔不绝 210 | 虚情假意 211 | 推心置腹 212 | 旁敲侧击 213 | 喋喋不休 214 | 慢条斯理 215 | 含糊其词 216 | 唠唠叨叨 217 | 振振有辞 218 | 肆无忌惮 219 | 大言不惭 220 | 娓娓动听 221 | 绘声绘色 222 | 对答如流 223 | 自圆其说 224 | 闲言碎语 225 | 闭月羞花 226 | 沉鱼落雁 227 | 出水芙蓉 228 | 明眸皓齿 229 | 美如冠玉 230 | 倾国倾城 231 | 国色天香 232 | 鹤发童颜 233 | 眉清目秀 234 | 和蔼可亲 235 | 心慈面善 236 | 张牙舞爪 237 | 愁眉苦脸 238 | 冰清玉洁 239 | 雍容华贵 240 | 文质彬彬 241 | 威风凛凛 242 | 老态龙钟 243 | 虎背熊腰 244 | 如花似玉 245 | 容光焕发 246 | 落落大方 247 | 骨瘦如柴 248 | 大腹便便 249 | 面黄肌瘦 250 | 其貌不扬 251 | 蓬头垢面 252 | 弱不禁风 253 | 口若悬河 254 | 对答如流 255 | 滔滔不绝 256 | 谈笑风生 257 | 高谈阔论 258 | 豪言壮语 259 | 夸夸其谈 260 | 花言巧语 261 | 忐忑不安 262 | 心惊肉跳 263 | 心神不定 264 | 心猿意马 265 | 心慌意乱 266 | 七上八下 267 | 心急如焚 268 | 班门弄斧 269 | 孤芳自赏 270 | 居功自傲 271 | 目中无人 272 | 妄自尊大 273 | 忘乎所以 274 | 惟我独尊 275 | 自高自大 276 | 自鸣得意 277 | 自我陶醉 278 | 自命不凡 279 | 目空一切 280 | 不骄不躁 281 | 功成不居 282 | 戒骄戒躁 283 | 洗耳恭听 284 | 虚怀若谷 285 | 慎言谨行 286 | 学无止境 287 | 学而不厌 288 | 真才实学 289 | 学而不倦 290 | 发奋图强 291 | 废寝忘食 292 | 争分夺秒 293 | 孜孜不倦 294 | 笨鸟先飞 295 | 闻鸡起舞 296 | 自强不息 297 | 只争朝夕 298 | 不甘示弱 299 | 全力以赴 300 | 力争上游 301 | 披荆斩棘 302 | 奋不顾身 303 | 舍己为人 304 | 坚强不屈 305 | 赤胆忠心 306 | 不屈不挠 307 | 忠贞不渝 308 | 誓死不二 309 | 威武不屈 310 | 舍死忘生 311 | 肝胆相照 312 | 克己奉公 313 | 一丝不苟 314 | 两袖清风 315 | 见礼忘义 316 | 永垂不朽 317 | 顶天立地 318 | 豁达大度 319 | 兢兢业业 320 | 卖国求荣 321 | 恬不知耻 322 | 贪生怕死 323 | 厚颜无耻 324 | 神采奕奕 325 | 眉飞色舞 326 | 昂首挺胸 327 | 惊慌失措 328 | 漫不经心 329 | 垂头丧气 330 | 没精打采 331 | 愁眉苦脸 332 | 大惊失色 333 | 炯炯有神 334 | 怒发冲冠 335 | 一目十行 336 | 一日千里 337 | 一字千金 338 | 百发百中 339 | 一日三秋 340 | 不毛之地 341 | 不计其数 342 | 胆大包天 343 | 寸步难行 344 | 一步登天 345 | 千钧一发 346 | 观者如云 347 | 挥金如土 348 | 铁证如山 349 | 爱财如命 350 | 稳如泰山 351 | 门庭若市 352 | 骨瘦如柴 353 | 冷若冰霜 354 | 如雷贯耳 355 | 守口如瓶 356 | 浩如烟海 357 | 高手如林 358 | 阳春三月 359 | 春光明媚 360 | 春回大地 361 | 春暖花开 362 | 春意盎然 363 | 春意正浓 364 | 风和日丽 365 | 春花烂漫 366 | 鸟语花香 367 | 百鸟鸣春 368 | 百花齐放 369 | 莺歌燕舞 370 | 赤日炎炎 371 | 烈日炎炎 372 | 骄阳似火 373 | 挥汗如雨 374 | 大汗淋漓 375 | 鸟语蝉鸣 376 | 万木葱茏 377 | 枝繁叶茂 378 | 莲叶满池 379 | 秋高气爽 380 | 天高云淡 381 | 秋风送爽 382 | 秋菊怒放 383 | 秋菊傲骨 384 | 秋色迷人 385 | 秋色宜人 386 | 金桂飘香 387 | 果实累累 388 | 北雁南飞 389 | 满山红叶 390 | 五谷丰登 391 | 芦花飘扬 392 | 天寒地冻 393 | 北风呼啸 394 | 滴水成冰 395 | 寒冬腊月 396 | 瑞雪纷飞 397 | 冰天雪地 398 | 冰封雪盖 399 | 漫天飞雪 400 | 白雪皑皑 401 | 冰封大地 402 | 冰天雪地 403 | 东方欲晓 404 | 旭日东升 405 | 万物初醒 406 | 空气清醒 407 | 雄鸡报晓 408 | 晨雾弥漫 409 | 晨光绚丽 410 | 烈日当头 411 | 丽日临空 412 | 艳阳高照 413 | 万里无云 414 | 碧空如洗 415 | 日落西山 416 | 夕阳西斜 417 | 残阳如血 418 | 炊烟四起 419 | 百鸟归林 420 | 华灯初上 421 | 夜幕低垂 422 | 日薄西山 423 | 夜深人静 424 | 月明星稀 425 | 夜色柔美 426 | 夜色迷人 427 | 深更半夜 428 | 漫漫长夜 429 | 风光秀丽 430 | 人山人海 431 | 车水马龙 432 | 宁静和谐 433 | 草木苍翠 434 | 竹篱瓦舍 435 | 山幽路辟 436 | 小桥流水 437 | 直指青云 438 | 古色古香 439 | 青砖素瓦 440 | 耸入碧云 441 | 机器轰鸣 442 | 铁流直泻 443 | 热气腾腾 444 | 钢花飞溅 445 | 粉饰一新 446 | 门可罗雀 447 | 冷冷清清 448 | 错落有致 449 | 富丽堂皇 450 | 设施齐全 451 | 气势雄伟 452 | 金碧辉煌 453 | 风景如画 454 | 闻名遐迩 455 | 井然有序 456 | 杂乱无章 457 | 布局巧妙 458 | 错落有致 459 | 宽阔平坦 460 | 崎岖不平 461 | 拥挤不堪 462 | 畅通无阻 463 | 花红柳绿 464 | 花色迷人 465 | 花香醉人 466 | 花枝招展 467 | 百花齐放 468 | 百花盛开 469 | 百花争艳 470 | 绚丽多彩 471 | 五彩缤纷 472 | 姹紫嫣红 473 | 绿草如茵 474 | 一碧千里 475 | 杂草丛生 476 | 生机勃勃 477 | 苍翠挺拔 478 | 郁郁葱葱 479 | 枯木逢春 480 | 秀丽多姿 481 | 青翠欲滴 482 | 林海雪原 483 | 耸入云天 484 | 瓜果蔬菜 485 | 清香鲜嫩 486 | 青翠欲滴 487 | 果园飘香 488 | 果实累累 489 | 果实饱满 490 | 鲜嫩水灵 491 | 象征和平 492 | 乳燕初飞 493 | 婉转悦耳 494 | 莺歌燕舞 495 | 翩然归来 496 | 枝头嬉戏 497 | 灰不溜秋 498 | 叽叽喳喳 499 | 鹦鹉学舌 500 | 婉转悦耳 501 | 笨嘴学舌 502 | 利嘴如铁 503 | 钢爪如钉 504 | 神气活现 505 | 昂首挺胸 506 | 肥大丰满 507 | 自由自在 508 | 引吭高歌 509 | 腾空而起 510 | 狂奔飞驰 511 | 膘肥体壮 512 | 昂首嘶鸣 513 | 瘦骨嶙峋 514 | 行动迟缓 515 | 俯首帖耳 516 | 膘肥体壮 517 | 川流不息 518 | 呼啸而过 519 | 穿梭往来 520 | 缓缓驶离 521 | 一叶扁舟 522 | 扬帆远航 523 | 乘风破浪 524 | 雾海夜航 525 | 追波逐浪 526 | 划破云层 527 | 直冲云霄 528 | 穿云而过 529 | 银鹰展翅 530 | 学习用品 531 | 美观实用 532 | 小巧玲珑 533 | 造型优美 534 | 设计独特 535 | 栩栩如生 536 | 活泼可爱 537 | 惹人喜爱 538 | 爱不释手 539 | 雨后彩虹 540 | 彩桥横空 541 | 若隐若现 542 | 光芒万丈 543 | 大雪纷飞 544 | 大雪封山 545 | 鹅毛大雪 546 | 漫天飞雪 547 | 瑞雪纷飞 548 | 林海雪原 549 | 风雪交加 550 | 雪上加霜 551 | 寒霜袭人 552 | 霜林尽染 553 | 垂露欲滴 554 | 朝露晶莹 555 | 日出露干 556 | 电光石火 557 | 雷电大作 558 | 惊天动地 559 | 春雷滚滚 560 | 电劈石击 561 | 雷电交加 562 | 阴雨连绵 563 | 牛毛细雨 564 | 秋雨连绵 565 | 随风飘洒 566 | 倾盆大雨 567 | 狂风暴雨 568 | 大雨滂沱 569 | 瓢泼大雨 570 | 大雨淋漓 571 | 暴雨如注 572 | 秋风送爽 573 | 金风送爽 574 | 北风呼啸 575 | 微风习习 576 | 寒风刺骨 577 | 风和日丽 578 | 大雾迷途 579 | 云雾茫茫 580 | 雾似轻纱 581 | 风吹雾散 582 | 云消雾散 583 | 彩云满天 584 | 天高云淡 585 | 乌云翻滚 586 | 彤云密布 587 | 彩霞缤纷 588 | 晚霞如火 589 | 朝霞灿烂 590 | 丹霞似锦 591 | 满天星斗 592 | 众星捧月 593 | 群星灿烂 594 | 万点繁星 595 | 月出东墙 596 | 月出东山 597 | 玉兔东升 598 | 月光皎洁 599 | 月色迷人 600 | 月牙初升 601 | 旭日东升 602 | 日上三竿 603 | 一轮红日 604 | 日高三尺 605 | 艳阳高照 606 | 烈日当头 607 | 骄阳似火 608 | 日影西斜 609 | 苦口婆心 610 | 口若悬河 611 | 心平气和 612 | 不慌不忙 613 | 语重心长 614 | 热情洋溢 615 | 恭恭敬敬 616 | 洗耳恭听 617 | 亲密无间 618 | 形影不离 619 | 情同手足 620 | 团结友爱 621 | 朝夕相处 622 | 人山人海 623 | 人声喧哗 624 | 人声嘈杂 625 | 人如潮涌 626 | 摩肩接踵 627 | 倾盆大雨 628 | 狂风暴雨 629 | 大雨滂沱 630 | 瓢泼大雨 631 | 读书学习 632 | 神情专注 633 | 学而不厌 634 | 学无止境 635 | 专心致志 636 | 日积月累 637 | 似懂非懂 638 | 普天同庆 639 | 彩旗飞舞 640 | 欢天喜地 641 | 张灯结彩 642 | 彻夜狂欢 643 | 兴高采烈 644 | 手舞足蹈 645 | 笨手笨脚 646 | 挤眉弄眼 647 | -------------------------------------------------------------------------------- /web/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /web/addProduct.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8"%> 3 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> 4 | 5 | 6 | 7 | 8 | 添加商品 9 | 19 | 20 | 21 |
23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 36 | 37 | 38 | 39 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 67 | 68 | 69 | 70 | 73 | 74 | 75 | 76 |
商品名称
商品价格
商品数量 35 |
商品类别一级分类: 40 | 46 | 二级分类: 47 | 50 | 三级分类: 51 |
商品图片
商品颜色
商品描述 66 |
   71 | 72 |
77 |
78 | 79 | 80 | 81 | 82 | -------------------------------------------------------------------------------- /web/addProductToCartSuccessfull.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8"%> 3 | 4 | 5 | 6 | 7 | 添加购物车成功 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 添加商品到购物车成功,是否继续购物? 16 | 查看购物车 17 | 继续购物 18 |
19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /web/error/activeuser_error.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8"%> 3 | 4 | 5 | 6 | 7 | 激活信息 8 | 9 | 10 |
11 | 12 | ${requestScope["active.message"]} 13 | 14 |
15 | 16 | -------------------------------------------------------------------------------- /web/error/registuser_error.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8"%> 3 | 4 | 5 | 6 | 7 | 注册信息 8 | 9 | 10 |
11 | 12 | ${requestScope["regist.message"]} 13 | 14 |
15 | 16 | -------------------------------------------------------------------------------- /web/fastbuy.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8"%> 3 | 4 | 5 | 6 | 7 | Insert title here 8 | 9 | 10 | 11 | 12 | 13 |
14 | 33 |
34 | 35 |
36 |
订单
37 |
38 |
    39 |
  • 商品名称
  • 40 |
  • 单价
  • 41 |
  • 数量
  • 42 |
  • 总价
  • 43 |
44 | 45 |
46 | 47 | 48 |
    49 | 50 |
      51 |
    • 52 | 53 |
    • 54 |
    • ${sessionScope.pro.description}
    • 55 |
    • ${sessionScope.pro.price}
    • 56 |
    • 1
    • 57 |
    58 | 59 | 60 |
    ${sessionScope.pro.price}
    61 |
62 |
63 | 69 |
70 |
71 | 80 |
81 |
82 |
    83 |
  • 开发人员1
  • 84 |
  • 唐宗博
  • 85 |
86 |
    87 |
  • 开发人员2
  • 88 |
  • 辜鹏
  • 89 |
90 |
91 |
92 | 93 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | -------------------------------------------------------------------------------- /web/home/JS/bg-canvas.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by WHY on 2016/12/5. 3 | */ 4 | function bg_canvas() { 5 | //获取窗口宽高 6 | var w = 400; 7 | var h = 608; 8 | var canvas = document.getElementById("myCanvas"); 9 | var ctx = canvas.getContext("2d"); 10 | //设置画布宽高与窗口宽高一样 11 | canvas.width = w+80; 12 | canvas.height = h+80; 13 | //随机数函数 14 | function fnRandom(min,max){ 15 | return parseInt((max-min)*Math.random()+min+1) 16 | } 17 | function Round(){ 18 | this.r = fnRandom(5,15); 19 | //随机位置 20 | var x = fnRandom(0,canvas.width - this.r); 21 | this.x = x2?speed:-speed; 27 | this.speedY = fnRandom(0,4)>2?speed:-speed; 28 | //颜色 29 | var col=new Array ("#a7a9ed","#a7c3f3","#cbccf6","#8097ec","#c7b4fd"); 30 | this.color = col[fnRandom(-1,4)]; 31 | } 32 | Round.prototype.draw = function(){ 33 | //绘制函数 34 | ctx.fillStyle = this.color; 35 | ctx.beginPath() 36 | ctx.arc(this.x,this.y,this.r,0,Math.PI*2,true); 37 | ctx.closePath(); 38 | ctx.fill(); 39 | } 40 | Round.prototype.move = function(){ 41 | this.x+=this.speedX; 42 | if(this.x>canvas.width-this.r){ 43 | // this.speedX*=-1; 44 | this.x=this.r 45 | 46 | }else if(this.xcanvas.height-this.r){ 51 | // this.speedY*=-1; 52 | this.y=this.r 53 | }else if(this.y 0.03 ? 0.03 : C; 90 | ctx.strokeStyle = 'rgba(0,0,0,'+ o +')' 91 | ctx.beginPath() 92 | ctx.lineWidth=3; 93 | ctx.moveTo(dxdy[i].dx,dxdy[i].dy) 94 | ctx.lineTo(dxdy[j].dx,dxdy[j].dy); 95 | ctx.closePath() 96 | ctx.stroke() 97 | } 98 | } 99 | window.requestAnimationFrame(roundMove) 100 | } 101 | roundMove(); 102 | } 103 | $(window).ready(function () { 104 | bg_canvas(); 105 | }) 106 | $(window).resize(function () { 107 | bg_canvas(); 108 | }) -------------------------------------------------------------------------------- /web/home/JS/main.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by WHY on 2016/12/13. 3 | */ 4 | (function($) { 5 | /*Preloader*/ 6 | $(window).on('load',function () { 7 | $('#status').fadeOut(); 8 | $('#preloader').delay(300).fadeOut('slow'); 9 | }); 10 | 11 | $(document).ready(function () { 12 | $(document).scroll(function () { 13 | var top = $(window).scrollTop(); 14 | var footerTop = $("footer").offset().top - 150; 15 | var windowHeight = $(window).height(); 16 | var sideH = $("html aside.aside-menu").height(); 17 | if (sideH >= footerTop - top - 135) { 18 | $("body aside.aside-menu").css("position", "absolute"); 19 | $("body aside.aside-menu").css("top", footerTop - sideH - 40); 20 | } 21 | if (top <= footerTop - sideH - 160) { 22 | if (sideH >= footerTop - top - 135) { 23 | sideH == 776; 24 | $("body aside").css("position", "absolute"); 25 | $("body aside").css("top", footerTop - sideH - 40); 26 | } 27 | $("body aside.aside-menu").css("position", "fixed"); 28 | $("body aside.aside-menu").css("top", "102px"); 29 | } 30 | 31 | if (top > windowHeight / 3) { 32 | $("body aside.aside-tool li:last-child").css("display", "block"); 33 | } else { 34 | $("body aside.aside-tool li:last-child").css("display", "none"); 35 | } 36 | }) 37 | 38 | /*返回顶部*/ 39 | $("body aside.aside-tool li:last-child").click(function () { 40 | var speed = $(window).scrollTop() / (($("footer").offset().top - 150) * 2 / $(window).height());//滑动的速度 41 | $('body,html').animate({scrollTop: 0}, speed); 42 | }); 43 | 44 | 45 | var t = $(".details .text-box"); 46 | 47 | $('.details .min').attr('disabled',true); 48 | 49 | $(".details .add").click(function(){ 50 | t.val(parseInt(t.val())+1) 51 | if (parseInt(t.val())!=1){ 52 | $('.details .min').attr('disabled',false); 53 | } 54 | }) 55 | 56 | $(".details .min").click(function(){ 57 | t.val(parseInt(t.val())-1); 58 | if (parseInt(t.val())==1){ 59 | $('.details .min').attr('disabled',true); 60 | } 61 | }) 62 | 63 | $(".sum-btn").bind("click",function(){ 64 | alert("已提交订单!确定将返回首页!"); 65 | }); 66 | //产品选择 67 | $('.Checkbox label').on('click', function () { 68 | var t = $(this); 69 | var is = t.hasClass('checked'); 70 | if (is) { 71 | t.removeClass('checked'); 72 | } else { 73 | $('.carts-foot .sum').css("background", "#ff9900"); 74 | $('.carts-foot .sum').css("cursor", "pointer"); 75 | t.addClass('checked'); 76 | } 77 | isall();//是否全选 78 | }); 79 | 80 | //全选 81 | $('#all-select+label,#all-select-1+label').on('click', function () { 82 | var t = $("#all-select+label,#all-select-1+label"); 83 | var is = t.hasClass('checked'); 84 | var li = $('.carts-content .Checkbox label'); 85 | if (is) { 86 | t.removeClass('checked'); 87 | li.removeClass('checked'); 88 | $('.carts-foot .sum').css("background", "#686868"); 89 | $('.carts-foot .sum').css("cursor", "not-allowed"); 90 | } else { 91 | t.addClass('checked'); 92 | li.addClass('checked'); 93 | $('.carts-foot .sum').css("background", "#ff9900"); 94 | $('.carts-foot .sum').css("cursor", "pointer"); 95 | } 96 | }) 97 | 98 | //判断是否全选 99 | function isall() { 100 | var all = $('#all-select+label,#all-select-1+label') 101 | var allnum = $('.carts-content .Checkbox label').length; 102 | var checknum = $('.carts-content .Checkbox label.checked').length; 103 | if (checknum == allnum) { 104 | all.addClass('checked') 105 | } else { 106 | all.removeClass('checked') 107 | } 108 | if (checknum <= 0) { 109 | $('.carts-foot .sum').css("background", "#686868"); 110 | $('.carts-foot .sum').css("cursor", "not-allowed"); 111 | } 112 | } 113 | 114 | /*注销*/ 115 | var logoutL = $(".user").css("width"); 116 | $(".user,.logout").bind("mouseover", function () { 117 | $("span .user+.logout").css("left", logoutL); 118 | $(".user+.logout").css("display", "block"); 119 | $(".user").css("border", "#8195e4 2px solid"); 120 | }) 121 | $(".user,.logout").bind("mouseout", function () { 122 | $("span .user+.logout").css("left", "0"); 123 | $(".user+.logout").css("display", "none"); 124 | $(".user").css("border", "transparent 2px solid"); 125 | }) 126 | 127 | $("dl dt").bind("click", function () { 128 | $(this).find("i").attr("class") == "i" ? $(this).find("i").attr("class", "") : $("dt i").attr("class", "") && $(this).find("i").attr("class", "i"); 129 | $("dl dd").removeClass("n"); 130 | }) 131 | $("dl dd").bind("click", function () { 132 | $("dl dd").removeClass("n"); 133 | $(this).addClass("n"); 134 | }) 135 | 136 | var i = 0; 137 | $(".wrap-right").bind("click", function () { 138 | i++; 139 | if (i > 5) { 140 | i = 0; 141 | } 142 | $(".slide ul:first-child").animate({left: i * 235 - 1175}, 200); 143 | $(".slide ul:last-child").animate({left: i * 235}, 200); 144 | }) 145 | $(".wrap-left").bind("click", function () { 146 | i--; 147 | if (i < 0) { 148 | i = 5; 149 | } 150 | $(".slide ul:first-child").animate({left: i * 235 - 1175}, 200); 151 | $(".slide ul:last-child").animate({left: i * 235}, 200); 152 | }) 153 | 154 | 155 | /*登录注册*/ 156 | $(function () { 157 | $("#log-move").draggable({containment: "#log-wrapper", scroll: false}); 158 | }); 159 | $("#navs-slider a").bind("click", function () { 160 | signup_in(this); 161 | }) 162 | $(".signup").bind("click", function () { 163 | signup(); 164 | }) 165 | $(".signin").bind("click", function () { 166 | signin(); 167 | }) 168 | 169 | /*提示*/ 170 | $(function () { 171 | $("[data-toggle='tooltip']").tooltip(); 172 | }); 173 | $("form input").keyup(function () { 174 | $("form span").css("transform", "translateX(200px)"); 175 | }) 176 | if ($("form span").val() != null) { 177 | $("form span").css("transform", "translateX(0px)"); 178 | } 179 | /*邮箱补全*/ 180 | $("#email_adress").keyup(function () { 181 | email_complete(this); 182 | }) 183 | $("#signup-email_adress").keyup(function () { 184 | email_complete(this); 185 | }) 186 | /*验证码*/ 187 | $("#password-1").focus(function () { 188 | $('#sign-form-1 .captcha').animate({height: "49px"}, 300); 189 | $('#sign-form-1 .captcha').css("border-top", "1px solid #d5d5d5"); 190 | }); 191 | 192 | /*购买页面*/ 193 | var ul = $(".product-img ul"); 194 | var count = 0; 195 | var liN = $(".product-img li").length; 196 | var li = $(".product-img li") 197 | var viewImg = $(".product-img .view img")[0]; 198 | var liImg = $(".product-img li"); 199 | $(".product-img li").hover(function () { 200 | $(".product-img li").attr("class", ""); 201 | $(this).addClass("n-hover"); 202 | viewImg.src = liImg.eq(count).find("img")[0].src; 203 | count = $(this).index(); 204 | }) 205 | $(".product-img a.up").bind("click", function () { 206 | count--; 207 | if (count < 0) { 208 | count = liN - 1; 209 | } 210 | if (count > 5) { 211 | ul.css("top", -(count - 5) * 68); 212 | } 213 | console.info(liN); 214 | console.info(count); 215 | if (count == 0) { 216 | ul.css("top", "0"); 217 | } 218 | li.attr("class", ""); 219 | li.eq(count).addClass("n-hover"); 220 | viewImg.src = liImg.eq(count).find("img")[0].src; 221 | /*$(".product-img ul").css("top",count*68); 222 | if(j*68>0){ 223 | $(".product-img ul").css("top"); 224 | }*/ 225 | }) 226 | $(".product-img a.down").bind("click", function () { 227 | count++; 228 | if (count > liN - 1) { 229 | count = 0; 230 | } 231 | if (count > 5) { 232 | ul.css("top", -(count - 5) * 68); 233 | } 234 | console.info(liN); 235 | console.info(count); 236 | if (count == 0) { 237 | ul.css("top", "0"); 238 | } 239 | li.attr("class", ""); 240 | li.eq(count).addClass("n-hover"); 241 | viewImg.src = liImg.eq(count).find("img")[0].src; 242 | /*var ulH =$(".product-img ul").css("height"); 243 | $(".product-img ul").css("top",count*68);*/ 244 | }) 245 | 246 | //登录注册切换 247 | function signup_in(sid) { 248 | if ($(sid).attr("id") == "#signin") { 249 | signin(); 250 | } else { 251 | signup(); 252 | } 253 | } 254 | 255 | function signin() { 256 | $("#navs-slider a").attr("class", ""); 257 | $("#navs-slider a:first-child").addClass("active"); 258 | $(".navs-slider-bar").animate({left: "0"}, 50); 259 | $("#sign-form-1").css("display", "block"); 260 | $("#sign-form-2").css("display", "none"); 261 | $("#sign-form-1 input").val(""); 262 | $('#sign-form-2 .captcha').css({"border-top": "0", "height": "0"}); 263 | $("form span").css("transform", "translateX(200px)"); 264 | } 265 | 266 | function signup() { 267 | $("#navs-slider a").attr("class", ""); 268 | $("#navs-slider a:nth-child(2)").attr("class", "active"); 269 | $(".navs-slider-bar").animate({left: "4em"}, 50); 270 | $("#sign-form-1").css("display", "none"); 271 | $("#sign-form-2").css("display", "block"); 272 | $("#sign-form-2 input").val(""); 273 | $('#sign-form-1 .captcha').css({"border-top": "0", "height": "0"}); 274 | $("form span").css("transform", "translateX(200px)"); 275 | $("#repassword").focus(function () { 276 | $("#sign-form-2 .captcha").animate({height: "49px"}, 300); 277 | $('#sign-form-2 .captcha').css("border-top", "1px solid #d5d5d5"); 278 | $("form span").css("transform", "translateX(0px)"); 279 | }); 280 | } 281 | 282 | 283 | //邮箱自动补全 284 | function email_complete(eid) { 285 | var inputVal = $(eid).val(); 286 | var myVal = inputVal.split("@"); 287 | var email_adress = new Array(myVal + "@qq.com", myVal + "@163.com", myVal + "@sina.com", myVal + "@gmail.com", myVal + "@126.com", 288 | myVal + "@hotmail.com", myVal + "@vip.qq.com", myVal + "@foxmail.com", myVal + "@sina.cn", myVal + "@yeah.net", 289 | myVal + "@sohu.com", myVal + "@live.cn", myVal + "@outlook.com", myVal + "@aliyun.com", myVal + "@yahoo.com"); 290 | $(eid).autocomplete({ 291 | source: email_adress 292 | }); 293 | } 294 | }); 295 | })(jQuery); -------------------------------------------------------------------------------- /web/home/img/22d94f6e50d98f6f68308814ff9795e2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/web/home/img/22d94f6e50d98f6f68308814ff9795e2.jpg -------------------------------------------------------------------------------- /web/home/img/260f712dc7bc066d147e305664ccd209.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/web/home/img/260f712dc7bc066d147e305664ccd209.jpg -------------------------------------------------------------------------------- /web/home/img/387064f7e285263ac3ef81dd09baf5e4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/web/home/img/387064f7e285263ac3ef81dd09baf5e4.png -------------------------------------------------------------------------------- /web/home/img/40ff95a5685129d242841d69e86f45d5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/web/home/img/40ff95a5685129d242841d69e86f45d5.png -------------------------------------------------------------------------------- /web/home/img/43a307471a19a9a0c54fa19a4328bf5e.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/web/home/img/43a307471a19a9a0c54fa19a4328bf5e.png -------------------------------------------------------------------------------- /web/home/img/43fa848fa20b7568d825bfa1bf8826f6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/web/home/img/43fa848fa20b7568d825bfa1bf8826f6.jpg -------------------------------------------------------------------------------- /web/home/img/4d98b5a1ad13dfdf6bf363a19dc88b2d.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/web/home/img/4d98b5a1ad13dfdf6bf363a19dc88b2d.png -------------------------------------------------------------------------------- /web/home/img/5b59d6d7503f921a1a5590a1999f9a3f.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/web/home/img/5b59d6d7503f921a1a5590a1999f9a3f.jpg -------------------------------------------------------------------------------- /web/home/img/62f38e9081afaf20535678571aaf6b3b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/web/home/img/62f38e9081afaf20535678571aaf6b3b.jpg -------------------------------------------------------------------------------- /web/home/img/8cbbaae5979d138dbc9e9616a06ba125.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/web/home/img/8cbbaae5979d138dbc9e9616a06ba125.png -------------------------------------------------------------------------------- /web/home/img/96d31465c590e6a93094d6cf016f36e6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/web/home/img/96d31465c590e6a93094d6cf016f36e6.png -------------------------------------------------------------------------------- /web/home/img/9beed483ba60c3ba71e72ad1cdb6d653.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/web/home/img/9beed483ba60c3ba71e72ad1cdb6d653.png -------------------------------------------------------------------------------- /web/home/img/9fb4c3da041a492d3853158c928da7ae.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/web/home/img/9fb4c3da041a492d3853158c928da7ae.png -------------------------------------------------------------------------------- /web/home/img/a26257f984753c787d177d74abaa7f04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/web/home/img/a26257f984753c787d177d74abaa7f04.png -------------------------------------------------------------------------------- /web/home/img/add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/web/home/img/add.png -------------------------------------------------------------------------------- /web/home/img/bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/web/home/img/bg.png -------------------------------------------------------------------------------- /web/home/img/dd1c6b91990dee6177ad2ef4c1fb076e.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/web/home/img/dd1c6b91990dee6177ad2ef4c1fb076e.png -------------------------------------------------------------------------------- /web/home/img/e557c50318135d0f705498c91ae62852.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/web/home/img/e557c50318135d0f705498c91ae62852.jpg -------------------------------------------------------------------------------- /web/home/img/gou.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/web/home/img/gou.png -------------------------------------------------------------------------------- /web/home/img/holiday_hero_subhead_2a_largetall.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/web/home/img/holiday_hero_subhead_2a_largetall.jpg -------------------------------------------------------------------------------- /web/home/img/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/web/home/img/icon.png -------------------------------------------------------------------------------- /web/home/img/iphone_square_large.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/web/home/img/iphone_square_large.jpg -------------------------------------------------------------------------------- /web/home/img/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/web/home/img/logo.png -------------------------------------------------------------------------------- /web/home/img/macbookpro_large.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/web/home/img/macbookpro_large.jpg -------------------------------------------------------------------------------- /web/home/img/preloader.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/web/home/img/preloader.gif -------------------------------------------------------------------------------- /web/home/img/tile_macos_large.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/web/home/img/tile_macos_large.jpg -------------------------------------------------------------------------------- /web/home/img/top.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpengDemo/Estore/f6eb0179440a4d6250ef06eefe62aaf2d4cba4a0/web/home/img/top.png -------------------------------------------------------------------------------- /web/index.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8"%> 3 | 4 | 5 | 6 | 7 | Insert title here 8 | 9 | 10 | 18 | 19 |
20 |
21 |
22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /web/order.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8"%> 3 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> 4 | 5 | 6 | 7 | 8 | Insert title here 9 | 10 | 11 | 12 | 13 |
14 | 33 |
34 | 35 |
36 |
订单
37 |
38 |
    39 |
  • 商品名称
  • 40 |
  • 单价
  • 41 |
  • 数量
  • 42 |
  • 总价
  • 43 |
44 | 45 |
46 | 47 | 48 |
    49 | 50 |
      51 |
    • 52 | 53 |
    • 54 |
    • ${c.key.description}
    • 55 |
    • ${c.key.price }
    • 56 |
    • ${c.value}
    • 57 |
    58 | 59 |
    60 | 61 |
    ${money}
    62 |
63 |
64 | 71 |
72 |
73 | 82 |
83 |
84 |
    85 |
  • 开发人员1
  • 86 |
  • 唐宗博
  • 87 |
88 |
    89 |
  • 开发人员2
  • 90 |
  • 辜鹏
  • 91 |
92 |
93 |
94 | 95 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | -------------------------------------------------------------------------------- /web/order_success.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8"%> 3 | 4 | 5 | 6 | 7 | 交易 8 | 9 | 10 |

交易成功

11 | 12 | 13 | -------------------------------------------------------------------------------- /web/product.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8"%> 3 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> 4 | 5 | 6 | 7 | 8 | product 9 | 10 | 11 | 12 | 30 | 31 | 32 |
33 |
34 |
35 |
36 | 55 |
56 | 57 | 58 | 134 | 135 | 136 | 137 |
138 | 151 | 152 |
153 | 154 |
155 | 156 | ${p.name} 157 | ${p.description} 158 | ${p.price} 159 | 160 |
161 |
162 |
163 | 173 |
174 | 183 |
184 |
185 |
    186 |
  • 开发人员1
  • 187 |
  • 唐宗博
  • 188 |
189 |
    190 |
  • 开发人员2
  • 191 |
  • 辜鹏
  • 192 |
193 |
194 |
195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | -------------------------------------------------------------------------------- /web/productInfo_admin.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> 2 | <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> 3 | 4 | 5 | 6 | My JSP 'index.jsp' starting page 7 | 17 | 18 | 19 |
20 | 21 | 22 | 商品名称:
23 | 商品价格: 24 | 25 |
26 | 27 | 商品类别: 28 | <%-- --%> 29 | 一级分类: 30 | 36 | 二级分类: 37 | 40 | 三级分类: 41 | 44 |
45 | 46 | 商品数量:
47 | 商品图片:
48 | 商品颜色:
49 | 商品描述:
50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /web/productInfo_user.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8"%> 3 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> 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 |
55 |

${pro.description}

56 |

产品编号:RE201612101843132

57 |

58 | 价格 59 | ${pro.price } 60 |

61 | 74 |
75 | 立即购买 76 | 77 | 加入购物车 78 |
79 |
80 |
81 | 82 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | -------------------------------------------------------------------------------- /web/regist_success.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8"%> 3 | 4 | 5 | 6 | 7 | 注册成功3秒后跳转 8 | 9 | 10 | 11 |

12 | 注册成功,3秒后跳转到首页 13 |

14 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /web/showProducts.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8"%> 3 | <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> 4 | 5 | 6 | 7 | 8 | Insert title here 9 | 56 | 57 | 58 | 59 | 60 | 61 | 无商品信息
62 | 添加 63 |
64 | 65 | 66 | 67 |
68 |
69 | 74 | 75 | 76 |
77 |
78 |
79 |
80 | 81 | 82 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 111 | 112 | 113 | 114 | 115 | 117 | 118 |
83 | 商品编号商品名称商品价格商品数量商品分类商品颜色商品图片商品描述操作
${p.id }${p.name}${p.price }${p.pnum }${p.c3code }${p.color }图片不存在或已删除${p.description }编辑 108 | 109 |  删除 110 |
删除选中添加 116 |
119 |
120 |
121 | 122 | 123 | --------------------------------------------------------------------------------