├── .gitignore ├── .idea ├── .gitignore ├── artifacts │ ├── EPMW_war.xml │ └── EPMW_war_exploded.xml ├── dataSources.local.xml ├── dataSources.xml ├── dataSources │ ├── c2ea3cd3-116d-47ea-ad2d-097709722efb.xml │ └── c2ea3cd3-116d-47ea-ad2d-097709722efb │ │ └── storage_v2 │ │ └── _src_ │ │ └── schema │ │ └── information_schema.FNRwLQ.meta ├── inspectionProfiles │ └── Project_Default.xml ├── jsLibraryMappings.xml ├── libraries │ └── cos.xml ├── misc.xml ├── modules.xml ├── sqldialects.xml ├── uiDesigner.xml ├── vcs.xml └── workspace.xml ├── EPMW.iml ├── README.md ├── screenshot ├── 1.png ├── 10.png ├── 11.png ├── 12.png ├── 13.png ├── 14.png ├── 15.png ├── 2.png ├── 3.png ├── 4.png ├── 5.png ├── 6.png ├── 7.png ├── 8.png └── 9.png ├── sql └── epmw.sql ├── src ├── dao │ ├── AdminDao.java │ ├── GoodsDao.java │ ├── OrderDao.java │ └── UserDao.java ├── db.properties ├── filter │ ├── AdminLoginFilter.java │ ├── EncodeFilter.java │ └── UserLoginFilter.java ├── servlet │ ├── AddCart.java │ ├── ChangeCart.java │ ├── ChangeOrderState.java │ ├── CheckCode.java │ ├── CreateOrder.java │ ├── ListMyOrders.java │ ├── Login.java │ ├── Logout.java │ ├── ModifyUserInfo.java │ ├── OrderDetail.java │ ├── Register.java │ ├── ShowAllGoods.java │ └── admin │ │ ├── ChangeGoodsState.java │ │ ├── ChangeOrderStateAdmin.java │ │ ├── LoginAdmin.java │ │ ├── ManageOrders.java │ │ ├── ModifyAdminInfo.java │ │ ├── OrderDetailAdmin.java │ │ └── UpdateGoods.java ├── utils │ ├── JdbcUtil.java │ └── StringUtil.java └── vo │ ├── Admin.java │ ├── Goods.java │ ├── Order.java │ ├── OrderItem.java │ ├── Page.java │ └── User.java └── web ├── WEB-INF ├── lib │ └── cos.jar └── web.xml ├── admin.jsp ├── createOrder.jsp ├── css ├── default.css ├── mdui.css ├── mdui.min.css └── mdui.min.css.map ├── fonts └── roboto │ ├── LICENSE.txt │ ├── Roboto-Black.woff │ ├── Roboto-Black.woff2 │ ├── Roboto-BlackItalic.woff │ ├── Roboto-BlackItalic.woff2 │ ├── Roboto-Bold.woff │ ├── Roboto-Bold.woff2 │ ├── Roboto-BoldItalic.woff │ ├── Roboto-BoldItalic.woff2 │ ├── Roboto-Light.woff │ ├── Roboto-Light.woff2 │ ├── Roboto-LightItalic.woff │ ├── Roboto-LightItalic.woff2 │ ├── Roboto-Medium.woff │ ├── Roboto-Medium.woff2 │ ├── Roboto-MediumItalic.woff │ ├── Roboto-MediumItalic.woff2 │ ├── Roboto-Regular.woff │ ├── Roboto-Regular.woff2 │ ├── Roboto-RegularItalic.woff │ ├── Roboto-RegularItalic.woff2 │ ├── Roboto-Thin.woff │ ├── Roboto-Thin.woff2 │ ├── Roboto-ThinItalic.woff │ └── Roboto-ThinItalic.woff2 ├── goodManagerAdmin.jsp ├── header.jsp ├── headerAdmin.jsp ├── icons └── material-icons │ ├── LICENSE.txt │ ├── MaterialIcons-Regular.ijmap │ ├── MaterialIcons-Regular.woff │ └── MaterialIcons-Regular.woff2 ├── images └── default.jpg ├── img ├── admin_login_bg.jpg └── user_login_bg.jpg ├── js ├── mdui.js ├── mdui.min.js └── mdui.min.js.map ├── listMyOrders.jsp ├── login.jsp ├── main.jsp ├── modify.jsp ├── modifyAdmin.jsp ├── modifyGoods.jsp ├── orderDetail.jsp ├── orderDetailAdmin.jsp ├── orderManagerAdmin.jsp ├── register.jsp └── showCart.jsp /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | 3 | out/ 4 | -------------------------------------------------------------------------------- /.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /workspace.xml 3 | 4 | # Datasource local storage ignored files 5 | /dataSources/ 6 | /dataSources.local.xml -------------------------------------------------------------------------------- /.idea/artifacts/EPMW_war.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | $PROJECT_DIR$/out/artifacts/EPMW_war 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/artifacts/EPMW_war_exploded.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | $PROJECT_DIR$/out/artifacts/EPMW_war_exploded 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /.idea/dataSources.local.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | #@ 7 | ` 8 | 9 | 10 | master_key 11 | root 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /.idea/dataSources.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | mysql.8 6 | true 7 | com.mysql.cj.jdbc.Driver 8 | jdbc:mysql://localhost:3306/epmw?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/dataSources/c2ea3cd3-116d-47ea-ad2d-097709722efb/storage_v2/_src_/schema/information_schema.FNRwLQ.meta: -------------------------------------------------------------------------------- 1 | #n:information_schema 2 | ! [null, 0, null, null, -2147483648, -2147483648] 3 | -------------------------------------------------------------------------------- /.idea/inspectionProfiles/Project_Default.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 36 | -------------------------------------------------------------------------------- /.idea/jsLibraryMappings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/libraries/cos.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.idea/sqldialects.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.idea/uiDesigner.xml: -------------------------------------------------------------------------------- 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 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /EPMW.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 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # EPMW 伊品美味餐饮管理系统 2 | “伊品美味”为随意取名,如有雷同,雨我无瓜。 3 | servlet+jsp+ajax编写的课后作业,入门水平。 4 | 运行说明: 5 | 需要先确保数据库正常连接,导入epmw.sql(我用的MySQL)文件。在db.properties配置好数据库账号密码和连接。 6 | 运行项目还需要jstl.jar,standard.jar和数据库的驱动程序。我把它们直接放Tomcat的lib目录了,所以项目中没有附带。 7 | UI库:[MDUI](https://www.mdui.org/) 8 | 在线地址 9 | [客户端](http://193.112.128.180:8080/epmw/) 10 | [管理端](http://193.112.128.180:8080/epmw/admin.jsp) 账号:admin 密码:1 11 | ## 效果图 12 | 客户端 13 | ![](https://raw.githubusercontent.com/Coyamo/EPMW/master/screenshot/1.png) 14 | ![](https://raw.githubusercontent.com/Coyamo/EPMW/master/screenshot/2.png) 15 | ![](https://raw.githubusercontent.com/Coyamo/EPMW/master/screenshot/3.png) 16 | ![](https://raw.githubusercontent.com/Coyamo/EPMW/master/screenshot/4.png) 17 | ![](https://raw.githubusercontent.com/Coyamo/EPMW/master/screenshot/5.png) 18 | ![](https://raw.githubusercontent.com/Coyamo/EPMW/master/screenshot/6.png) 19 | ![](https://raw.githubusercontent.com/Coyamo/EPMW/master/screenshot/7.png) 20 | ![](https://raw.githubusercontent.com/Coyamo/EPMW/master/screenshot/8.png) 21 | ![](https://raw.githubusercontent.com/Coyamo/EPMW/master/screenshot/9.png) 22 | 管理端 23 | ![](https://raw.githubusercontent.com/Coyamo/EPMW/master/screenshot/10.png) 24 | ![](https://raw.githubusercontent.com/Coyamo/EPMW/master/screenshot/11.png) 25 | ![](https://raw.githubusercontent.com/Coyamo/EPMW/master/screenshot/12.png) 26 | ![](https://raw.githubusercontent.com/Coyamo/EPMW/master/screenshot/13.png) 27 | ![](https://raw.githubusercontent.com/Coyamo/EPMW/master/screenshot/14.png) 28 | ![](https://raw.githubusercontent.com/Coyamo/EPMW/master/screenshot/15.png) 29 | 30 | -------------------------------------------------------------------------------- /screenshot/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Coyamo/EPMW/332304b32b2975769e5fea770f7644c5dd2d9dbd/screenshot/1.png -------------------------------------------------------------------------------- /screenshot/10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Coyamo/EPMW/332304b32b2975769e5fea770f7644c5dd2d9dbd/screenshot/10.png -------------------------------------------------------------------------------- /screenshot/11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Coyamo/EPMW/332304b32b2975769e5fea770f7644c5dd2d9dbd/screenshot/11.png -------------------------------------------------------------------------------- /screenshot/12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Coyamo/EPMW/332304b32b2975769e5fea770f7644c5dd2d9dbd/screenshot/12.png -------------------------------------------------------------------------------- /screenshot/13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Coyamo/EPMW/332304b32b2975769e5fea770f7644c5dd2d9dbd/screenshot/13.png -------------------------------------------------------------------------------- /screenshot/14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Coyamo/EPMW/332304b32b2975769e5fea770f7644c5dd2d9dbd/screenshot/14.png -------------------------------------------------------------------------------- /screenshot/15.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Coyamo/EPMW/332304b32b2975769e5fea770f7644c5dd2d9dbd/screenshot/15.png -------------------------------------------------------------------------------- /screenshot/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Coyamo/EPMW/332304b32b2975769e5fea770f7644c5dd2d9dbd/screenshot/2.png -------------------------------------------------------------------------------- /screenshot/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Coyamo/EPMW/332304b32b2975769e5fea770f7644c5dd2d9dbd/screenshot/3.png -------------------------------------------------------------------------------- /screenshot/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Coyamo/EPMW/332304b32b2975769e5fea770f7644c5dd2d9dbd/screenshot/4.png -------------------------------------------------------------------------------- /screenshot/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Coyamo/EPMW/332304b32b2975769e5fea770f7644c5dd2d9dbd/screenshot/5.png -------------------------------------------------------------------------------- /screenshot/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Coyamo/EPMW/332304b32b2975769e5fea770f7644c5dd2d9dbd/screenshot/6.png -------------------------------------------------------------------------------- /screenshot/7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Coyamo/EPMW/332304b32b2975769e5fea770f7644c5dd2d9dbd/screenshot/7.png -------------------------------------------------------------------------------- /screenshot/8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Coyamo/EPMW/332304b32b2975769e5fea770f7644c5dd2d9dbd/screenshot/8.png -------------------------------------------------------------------------------- /screenshot/9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Coyamo/EPMW/332304b32b2975769e5fea770f7644c5dd2d9dbd/screenshot/9.png -------------------------------------------------------------------------------- /sql/epmw.sql: -------------------------------------------------------------------------------- 1 | /* 2 | Navicat Premium Data Transfer 3 | 4 | Source Server : root 5 | Source Server Type : MySQL 6 | Source Server Version : 80019 7 | Source Host : localhost:3306 8 | Source Schema : epmw 9 | 10 | Target Server Type : MySQL 11 | Target Server Version : 80019 12 | File Encoding : 65001 13 | 14 | Date: 21/06/2020 11:19:23 15 | */ 16 | 17 | SET NAMES utf8mb4; 18 | SET FOREIGN_KEY_CHECKS = 0; 19 | 20 | -- ---------------------------- 21 | -- Table structure for admin 22 | -- ---------------------------- 23 | DROP TABLE IF EXISTS `admin`; 24 | CREATE TABLE `admin` 25 | ( 26 | `name` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, 27 | `password` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, 28 | PRIMARY KEY (`name`) USING BTREE 29 | ) ENGINE = InnoDB 30 | CHARACTER SET = utf8 31 | COLLATE = utf8_general_ci 32 | ROW_FORMAT = Dynamic; 33 | 34 | -- ---------------------------- 35 | -- Table structure for goods 36 | -- ---------------------------- 37 | DROP TABLE IF EXISTS `goods`; 38 | CREATE TABLE `goods` 39 | ( 40 | `id` int(0) NOT NULL AUTO_INCREMENT, 41 | `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, 42 | `price` float(10, 2) NOT NULL, 43 | `description` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, 44 | `image` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'default.jpg', 45 | `state` int(0) NOT NULL DEFAULT 0 COMMENT '是否上架 0否 1是 默认0', 46 | PRIMARY KEY (`id`) USING BTREE 47 | ) ENGINE = InnoDB 48 | AUTO_INCREMENT = 41 49 | CHARACTER SET = utf8 50 | COLLATE = utf8_general_ci 51 | ROW_FORMAT = Dynamic; 52 | 53 | -- ---------------------------- 54 | -- Table structure for order_datail 55 | -- ---------------------------- 56 | DROP TABLE IF EXISTS `order_datail`; 57 | CREATE TABLE `order_datail` 58 | ( 59 | `orderId` int(0) NOT NULL, 60 | `goodsId` int(0) NOT NULL, 61 | `count` int(0) NOT NULL, 62 | INDEX `fk1` (`orderId`) USING BTREE, 63 | INDEX `fk2` (`goodsId`) USING BTREE, 64 | CONSTRAINT `fk1` FOREIGN KEY (`orderId`) REFERENCES `orders` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT, 65 | CONSTRAINT `fk2` FOREIGN KEY (`goodsId`) REFERENCES `goods` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT 66 | ) ENGINE = InnoDB 67 | CHARACTER SET = utf8 68 | COLLATE = utf8_general_ci 69 | ROW_FORMAT = Dynamic; 70 | 71 | -- ---------------------------- 72 | -- Table structure for orders 73 | -- ---------------------------- 74 | DROP TABLE IF EXISTS `orders`; 75 | CREATE TABLE `orders` 76 | ( 77 | `id` int(0) NOT NULL AUTO_INCREMENT, 78 | `time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0), 79 | `price` float NOT NULL, 80 | `username` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, 81 | `state` int(0) NOT NULL DEFAULT 0, 82 | `phone` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, 83 | `address` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, 84 | `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, 85 | PRIMARY KEY (`id`) USING BTREE, 86 | INDEX `orders_user_username_fk` (`username`) USING BTREE, 87 | CONSTRAINT `orders_user_username_fk` FOREIGN KEY (`username`) REFERENCES `user` (`username`) ON DELETE RESTRICT ON UPDATE RESTRICT 88 | ) ENGINE = InnoDB 89 | AUTO_INCREMENT = 15 90 | CHARACTER SET = utf8 91 | COLLATE = utf8_general_ci 92 | ROW_FORMAT = Dynamic; 93 | 94 | -- ---------------------------- 95 | -- Table structure for user 96 | -- ---------------------------- 97 | DROP TABLE IF EXISTS `user`; 98 | CREATE TABLE `user` 99 | ( 100 | `username` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, 101 | `name` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, 102 | `password` varchar(12) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, 103 | `address` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, 104 | `phoneNumber` varchar(12) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, 105 | PRIMARY KEY (`username`) USING BTREE 106 | ) ENGINE = InnoDB 107 | CHARACTER SET = utf8 108 | COLLATE = utf8_general_ci 109 | ROW_FORMAT = Dynamic; 110 | 111 | SET FOREIGN_KEY_CHECKS = 1; 112 | -------------------------------------------------------------------------------- /src/dao/AdminDao.java: -------------------------------------------------------------------------------- 1 | package dao; 2 | 3 | import utils.JdbcUtil; 4 | import vo.Admin; 5 | 6 | import java.sql.Connection; 7 | import java.sql.PreparedStatement; 8 | import java.sql.ResultSet; 9 | import java.sql.SQLException; 10 | 11 | public class AdminDao { 12 | 13 | public void changePassword(Admin admin, String pwd) throws SQLException { 14 | Connection conn = null; 15 | PreparedStatement ps = null; 16 | try { 17 | conn = JdbcUtil.getConnection(); 18 | String sql = "update admin set password=? where name=? "; 19 | ps = conn.prepareStatement(sql); 20 | ps.setString(1, pwd); 21 | ps.setString(2, admin.getName()); 22 | ps.executeUpdate(); 23 | } finally { 24 | JdbcUtil.free(null, ps, conn); 25 | } 26 | } 27 | 28 | public Admin findAdminByName(String name) throws Exception { 29 | Connection conn = null; 30 | PreparedStatement ps = null; 31 | ResultSet rs = null; 32 | Admin admin = null; 33 | try { 34 | conn = JdbcUtil.getConnection(); 35 | String sql = "select * from admin where name=? "; 36 | ps = conn.prepareStatement(sql); 37 | ps.setString(1, name); 38 | rs = ps.executeQuery(); 39 | if (rs.next()) { 40 | admin = new Admin(); 41 | admin.setName(rs.getString(1)); 42 | admin.setPassword(rs.getString(2)); 43 | } 44 | } finally { 45 | JdbcUtil.free(rs, ps, conn); 46 | } 47 | return admin; 48 | } 49 | 50 | public Admin login(String name, String password) throws Exception { 51 | Admin admin = findAdminByName(name); 52 | if (admin == null) return null; 53 | if (admin.getPassword().equals(password)) { 54 | return admin; 55 | } 56 | return null; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/dao/GoodsDao.java: -------------------------------------------------------------------------------- 1 | package dao; 2 | 3 | import utils.JdbcUtil; 4 | import vo.Goods; 5 | import vo.Page; 6 | 7 | import javax.servlet.ServletContext; 8 | import java.io.File; 9 | import java.sql.Connection; 10 | import java.sql.PreparedStatement; 11 | import java.sql.ResultSet; 12 | import java.util.ArrayList; 13 | import java.util.List; 14 | 15 | public class GoodsDao { 16 | public void addGoods(Goods goods) throws Exception { 17 | Connection conn = null; 18 | PreparedStatement ps = null; 19 | try { 20 | conn = JdbcUtil.getConnection(); 21 | String sql = "insert into goods(name,price,description,image,state) values (?,?,?,?,?) "; 22 | ps = conn.prepareStatement(sql); 23 | ps.setString(1, goods.getName()); 24 | ps.setFloat(2, goods.getPrice()); 25 | ps.setString(3, goods.getDescription()); 26 | ps.setString(4, goods.getImage()); 27 | ps.setInt(5, goods.getState()); 28 | ps.executeUpdate(); 29 | } finally { 30 | JdbcUtil.free(null, ps, conn); 31 | } 32 | } 33 | 34 | public void changeState(int id, int state) throws Exception { 35 | Goods goods = findGoodsById(id); 36 | goods.setState(state); 37 | update(goods); 38 | } 39 | 40 | public void update(Goods goods) throws Exception { 41 | Connection conn = null; 42 | PreparedStatement ps = null; 43 | try { 44 | conn = JdbcUtil.getConnection(); 45 | String sql = "update goods set name=?,price=?,description=?,image=?,state=? where id=? "; 46 | ps = conn.prepareStatement(sql); 47 | ps.setString(1, goods.getName()); 48 | ps.setFloat(2, goods.getPrice()); 49 | ps.setString(3, goods.getDescription()); 50 | ps.setString(4, goods.getImage()); 51 | ps.setInt(5, goods.getState()); 52 | ps.setInt(6, goods.getId()); 53 | ps.executeUpdate(); 54 | } finally { 55 | JdbcUtil.free(null, ps, conn); 56 | } 57 | } 58 | 59 | public void clearOldImg(ServletContext ctx, int id) throws Exception { 60 | Connection conn = null; 61 | PreparedStatement ps = null; 62 | ResultSet rs = null; 63 | String image = null; 64 | try { 65 | String sql = "select image from goods where id=?"; 66 | conn = JdbcUtil.getConnection(); 67 | ps = conn.prepareStatement(sql); 68 | ps.setInt(1, id); 69 | rs = ps.executeQuery(); 70 | while (rs.next()) { 71 | image = rs.getString(1); 72 | } 73 | 74 | } finally { 75 | JdbcUtil.free(rs, ps, conn); 76 | } 77 | String path = ctx.getRealPath("images"); 78 | if (image != null && !"default.jpg".equalsIgnoreCase(image)) { 79 | File f = new File(path, image); 80 | if (f.exists()) { 81 | f.delete(); 82 | } 83 | } 84 | 85 | } 86 | 87 | public void delete(int id) throws Exception { 88 | Connection conn = null; 89 | PreparedStatement ps = null; 90 | try { 91 | conn = JdbcUtil.getConnection(); 92 | String sql = "delete from goods where id=?"; 93 | ps = conn.prepareStatement(sql); 94 | ps.setInt(1, id); 95 | ps.executeUpdate(); 96 | } finally { 97 | JdbcUtil.free(null, ps, conn); 98 | } 99 | } 100 | 101 | public Page queryGoodsByPage(int pageNum, int count, int state) throws Exception { 102 | Page page = new Page<>(); 103 | page.setCount(count); 104 | int allPageNum = (int) Math.ceil(getGoodsCount(state) / (float) count); 105 | if (allPageNum == 0) allPageNum = 1; 106 | page.setAllPageNum(allPageNum); 107 | if (pageNum > page.getAllPageNum()) pageNum = page.getAllPageNum(); 108 | if (pageNum <= 0) pageNum = 1; 109 | page.setCurrentPageNum(pageNum); 110 | 111 | int start = (pageNum - 1) * count; 112 | String sql; 113 | if (state != 2) { 114 | sql = "select * from goods where state=? limit ?,?"; 115 | } else { 116 | sql = "select * from goods limit ?,?"; 117 | } 118 | 119 | 120 | List list = new ArrayList<>(); 121 | Connection conn = null; 122 | PreparedStatement ps = null; 123 | ResultSet rs = null; 124 | Goods goods; 125 | try { 126 | conn = JdbcUtil.getConnection(); 127 | ps = conn.prepareStatement(sql); 128 | if (state != 2) { 129 | ps.setInt(1, state); 130 | ps.setInt(2, start); 131 | ps.setInt(3, count); 132 | } else { 133 | ps.setInt(1, start); 134 | ps.setInt(2, count); 135 | } 136 | 137 | rs = ps.executeQuery(); 138 | while (rs.next()) { 139 | goods = new Goods(); 140 | goods.setId(rs.getInt(1)); 141 | goods.setName(rs.getString(2)); 142 | goods.setPrice(rs.getFloat(3)); 143 | goods.setDescription(rs.getString(4)); 144 | goods.setImage(rs.getString(5)); 145 | goods.setState(rs.getInt(6)); 146 | list.add(goods); 147 | } 148 | 149 | } finally { 150 | JdbcUtil.free(rs, ps, conn); 151 | } 152 | page.setList(list); 153 | return page; 154 | } 155 | 156 | public int getGoodsCount(int state) throws Exception { 157 | int count = 0; 158 | Connection conn = null; 159 | PreparedStatement ps = null; 160 | ResultSet rs = null; 161 | try { 162 | conn = JdbcUtil.getConnection(); 163 | String sql; 164 | if (state != 2) { 165 | sql = "select count(*) from goods where state=?"; 166 | } else { 167 | sql = "select count(*) from goods"; 168 | } 169 | 170 | ps = conn.prepareStatement(sql); 171 | if (state != 2) { 172 | ps.setInt(1, state); 173 | } 174 | rs = ps.executeQuery(); 175 | if (rs.next()) { 176 | count = rs.getInt(1); 177 | } 178 | 179 | } finally { 180 | JdbcUtil.free(rs, ps, conn); 181 | } 182 | return count; 183 | } 184 | 185 | /* 186 | public List queryAllGoods() throws Exception { 187 | List list = new ArrayList<>(); 188 | Connection conn = null; 189 | PreparedStatement ps = null; 190 | ResultSet rs = null; 191 | Goods goods; 192 | try { 193 | conn = JdbcUtil.getConnection(); 194 | String sql = "select * from goods"; 195 | ps = conn.prepareStatement(sql); 196 | rs = ps.executeQuery(); 197 | while (rs.next()) { 198 | goods = new Goods(); 199 | goods.setId(rs.getInt(1)); 200 | goods.setName(rs.getString(2)); 201 | goods.setPrice(rs.getFloat(3)); 202 | goods.setDescription(rs.getString(4)); 203 | goods.setImage(rs.getString(5)); 204 | goods.setState(rs.getInt(6)); 205 | list.add(goods); 206 | } 207 | 208 | } finally { 209 | JdbcUtil.free(rs, ps, conn); 210 | } 211 | return list; 212 | } 213 | */ 214 | public Goods findGoodsById(int id) throws Exception { 215 | Connection conn = null; 216 | PreparedStatement ps = null; 217 | ResultSet rs = null; 218 | Goods goods = null; 219 | try { 220 | conn = JdbcUtil.getConnection(); 221 | String sql = "select * from goods where id=? "; 222 | ps = conn.prepareStatement(sql); 223 | ps.setInt(1, id); 224 | rs = ps.executeQuery(); 225 | if (rs.next()) { 226 | goods = new Goods(); 227 | goods.setId(rs.getInt(1)); 228 | goods.setName(rs.getString(2)); 229 | goods.setPrice(rs.getFloat(3)); 230 | goods.setDescription(rs.getString(4)); 231 | goods.setImage(rs.getString(5)); 232 | goods.setState(rs.getInt(6)); 233 | } 234 | } finally { 235 | JdbcUtil.free(rs, ps, conn); 236 | } 237 | return goods; 238 | } 239 | 240 | 241 | } 242 | -------------------------------------------------------------------------------- /src/dao/OrderDao.java: -------------------------------------------------------------------------------- 1 | package dao; 2 | 3 | import utils.JdbcUtil; 4 | import vo.Order; 5 | import vo.OrderItem; 6 | import vo.Page; 7 | import vo.User; 8 | 9 | import java.sql.*; 10 | import java.util.ArrayList; 11 | import java.util.Date; 12 | import java.util.List; 13 | 14 | public class OrderDao { 15 | 16 | /** 17 | * 给订单添加内容,如果存在就累计数量,不存在则添加 18 | * 19 | * @param order 订单 20 | * @param orderItem 购买的商品,Goods的封装 21 | */ 22 | public void addItem(Order order, OrderItem orderItem) { 23 | for (OrderItem item : order.getItems()) { 24 | if (item.getGoods().getId() == orderItem.getGoods().getId()) { 25 | item.setCount(item.getCount() + orderItem.getCount()); 26 | order.updatePrice(); 27 | return; 28 | } 29 | } 30 | order.getItems().add(orderItem); 31 | order.updatePrice(); 32 | } 33 | 34 | /** 35 | * 改变订单,如果orderItem存在,则替换数量,不存在则添加,数量<=0则移除 36 | * 37 | * @param order 38 | * @param orderItem 39 | */ 40 | public void changeItem(Order order, OrderItem orderItem) { 41 | for (OrderItem item : order.getItems()) { 42 | if (item.getGoods().getId() == orderItem.getGoods().getId()) { 43 | if (orderItem.getCount() <= 0) { 44 | order.getItems().remove(item); 45 | } else { 46 | item.setCount(orderItem.getCount()); 47 | } 48 | 49 | order.updatePrice(); 50 | return; 51 | } 52 | } 53 | order.getItems().add(orderItem); 54 | order.updatePrice(); 55 | } 56 | 57 | /** 58 | * 把订单存入数据库,user不是登录的user 而是登录的user的username和提交订单填的收货信息组成的 59 | * 60 | * @param order 61 | * @param user 62 | * @throws Exception 63 | */ 64 | public void addOrder(Order order, User user) throws Exception { 65 | Connection conn = null; 66 | PreparedStatement ps = null; 67 | ResultSet rs = null; 68 | try { 69 | order.setTime(new Timestamp(new Date().getTime())); 70 | conn = JdbcUtil.getConnection(); 71 | String sql = "insert into orders(time,price,username,state,phone,address,name) values (?,?,?,?,?,?,?) "; 72 | ps = conn.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS); 73 | ps.setTimestamp(1, order.getTime()); 74 | ps.setFloat(2, order.getPrice()); 75 | ps.setString(3, user.getUsername()); 76 | ps.setInt(4, order.getState()); 77 | ps.setString(5, user.getPhoneNumber()); 78 | ps.setString(6, user.getAddress()); 79 | ps.setString(7, user.getName()); 80 | ps.executeUpdate(); 81 | rs = ps.getGeneratedKeys(); 82 | if (rs.next()) { 83 | order.setId(rs.getInt(1)); 84 | } 85 | 86 | JdbcUtil.free(rs, ps, null); 87 | List orderItemList = order.getItems(); 88 | sql = "insert into order_datail values (?,?,?) "; 89 | ps = conn.prepareStatement(sql); 90 | for (OrderItem orderItem : orderItemList) { 91 | ps.setInt(1, order.getId()); 92 | ps.setInt(2, orderItem.getGoods().getId()); 93 | ps.setInt(3, orderItem.getCount()); 94 | ps.executeUpdate(); 95 | } 96 | 97 | 98 | } finally { 99 | JdbcUtil.free(rs, ps, conn); 100 | } 101 | } 102 | 103 | /** 104 | * 修改订单的状态 105 | * 106 | * @param orderId 107 | * @param state 108 | * @throws Exception 109 | */ 110 | public void changeOrderState(int orderId, int state) throws Exception { 111 | Connection conn = null; 112 | PreparedStatement ps = null; 113 | ResultSet rs = null; 114 | try { 115 | conn = JdbcUtil.getConnection(); 116 | String sql = "update orders set state=? where id=?"; 117 | ps = conn.prepareStatement(sql); 118 | ps.setInt(1, state); 119 | ps.setInt(2, orderId); 120 | ps.executeUpdate(); 121 | } finally { 122 | JdbcUtil.free(rs, ps, conn); 123 | } 124 | } 125 | 126 | /*public void changeOrderState(Order order, int state) throws Exception { 127 | changeOrderState(order.getId(), state); 128 | }*/ 129 | 130 | /** 131 | * 查询用户的订单记录,不包括详细的物品记录 132 | * 133 | * @param user 134 | * @return 135 | * @throws Exception 136 | */ 137 | public List queryOrdersWithoutItem(User user) throws Exception { 138 | List list = new ArrayList<>(); 139 | 140 | Connection conn = null; 141 | PreparedStatement ps = null; 142 | ResultSet rs = null; 143 | try { 144 | conn = JdbcUtil.getConnection(); 145 | String sql = "select * from orders where username=?"; 146 | ps = conn.prepareStatement(sql); 147 | ps.setString(1, user.getUsername()); 148 | rs = ps.executeQuery(); 149 | while (rs.next()) { 150 | Order order = new Order(); 151 | order.setId(rs.getInt(1)); 152 | order.setTime(rs.getTimestamp(2)); 153 | order.setPrice(rs.getFloat(3)); 154 | order.setState(rs.getInt(5)); 155 | order.setPhone(rs.getString(6)); 156 | order.setAddress(rs.getString(7)); 157 | order.setName(rs.getString(8)); 158 | list.add(order); 159 | } 160 | 161 | } finally { 162 | JdbcUtil.free(rs, ps, conn); 163 | } 164 | return list; 165 | } 166 | 167 | /** 168 | * 获取完整的订单信息,包括商品数据 169 | * 170 | * @param id 171 | * @return 172 | * @throws Exception 173 | */ 174 | public Order getOrderById(int id) throws Exception { 175 | Connection conn = null; 176 | PreparedStatement ps = null; 177 | ResultSet rs = null; 178 | try { 179 | conn = JdbcUtil.getConnection(); 180 | String sql = "select * from orders where id=?"; 181 | ps = conn.prepareStatement(sql); 182 | ps.setInt(1, id); 183 | rs = ps.executeQuery(); 184 | if (rs.next()) { 185 | Order order = new Order(); 186 | order.setId(rs.getInt(1)); 187 | order.setTime(rs.getTimestamp(2)); 188 | order.setPrice(rs.getFloat(3)); 189 | order.setState(rs.getInt(5)); 190 | order.setPhone(rs.getString(6)); 191 | order.setAddress(rs.getString(7)); 192 | order.setName(rs.getString(8)); 193 | JdbcUtil.free(rs, ps, null); 194 | sql = "select * from order_datail where orderId=?"; 195 | ps = conn.prepareStatement(sql); 196 | ps.setInt(1, order.getId()); 197 | rs = ps.executeQuery(); 198 | List list = order.getItems(); 199 | GoodsDao dao = new GoodsDao(); 200 | while (rs.next()) { 201 | OrderItem item = new OrderItem(); 202 | item.setGoods(dao.findGoodsById(rs.getInt(2))); 203 | item.setCount(rs.getInt(3)); 204 | list.add(item); 205 | } 206 | order.updatePrice(); 207 | return order; 208 | } 209 | 210 | } finally { 211 | JdbcUtil.free(rs, ps, conn); 212 | } 213 | return null; 214 | } 215 | 216 | public int getOrdersCount() throws Exception { 217 | int count = 0; 218 | Connection conn = null; 219 | PreparedStatement ps = null; 220 | ResultSet rs = null; 221 | try { 222 | conn = JdbcUtil.getConnection(); 223 | String sql = "select count(*) from orders"; 224 | ps = conn.prepareStatement(sql); 225 | rs = ps.executeQuery(); 226 | if (rs.next()) { 227 | count = rs.getInt(1); 228 | } 229 | 230 | } finally { 231 | JdbcUtil.free(rs, ps, conn); 232 | } 233 | return count; 234 | } 235 | 236 | /** 237 | * 分页查询,没有区分用户。用于管理员查询 238 | * 239 | * @param pageNum 240 | * @param count 241 | * @return 242 | * @throws Exception 243 | */ 244 | public Page queryOrdersByPage(int pageNum, int count) throws Exception { 245 | Page page = new Page<>(); 246 | page.setCount(count); 247 | int allPageNum = (int) Math.ceil(getOrdersCount() / (float) count); 248 | if (allPageNum == 0) allPageNum = 1; 249 | page.setAllPageNum(allPageNum); 250 | if (pageNum > page.getAllPageNum()) pageNum = page.getAllPageNum(); 251 | if (pageNum <= 0) pageNum = 1; 252 | page.setCurrentPageNum(pageNum); 253 | int start = (pageNum - 1) * count; 254 | String sql = "select * from orders limit ?,?"; 255 | 256 | List list = new ArrayList<>(); 257 | Connection conn = null; 258 | PreparedStatement ps = null; 259 | ResultSet rs = null; 260 | Order order; 261 | try { 262 | conn = JdbcUtil.getConnection(); 263 | ps = conn.prepareStatement(sql); 264 | ps.setInt(1, start); 265 | ps.setInt(2, count); 266 | 267 | rs = ps.executeQuery(); 268 | while (rs.next()) { 269 | order = new Order(); 270 | order.setId(rs.getInt(1)); 271 | order.setTime(rs.getTimestamp(2)); 272 | order.setPrice(rs.getFloat(3)); 273 | order.setState(rs.getInt(5)); 274 | order.setPhone(rs.getString(6)); 275 | order.setAddress(rs.getString(7)); 276 | order.setName(rs.getString(8)); 277 | list.add(order); 278 | } 279 | 280 | } finally { 281 | JdbcUtil.free(rs, ps, conn); 282 | } 283 | page.setList(list); 284 | return page; 285 | } 286 | } 287 | -------------------------------------------------------------------------------- /src/dao/UserDao.java: -------------------------------------------------------------------------------- 1 | package dao; 2 | 3 | import utils.JdbcUtil; 4 | import vo.User; 5 | 6 | import java.sql.Connection; 7 | import java.sql.PreparedStatement; 8 | import java.sql.ResultSet; 9 | 10 | public class UserDao { 11 | public void register(User user) throws Exception { 12 | Connection conn = null; 13 | PreparedStatement ps = null; 14 | try { 15 | conn = JdbcUtil.getConnection(); 16 | String sql = "insert into user values (?,?,?,?,?) "; 17 | ps = conn.prepareStatement(sql); 18 | ps.setString(1, user.getUsername()); 19 | ps.setString(2, user.getName()); 20 | ps.setString(3, user.getPassword()); 21 | ps.setString(4, user.getAddress()); 22 | ps.setString(5, user.getPhoneNumber()); 23 | ps.executeUpdate(); 24 | } finally { 25 | JdbcUtil.free(null, ps, conn); 26 | } 27 | } 28 | 29 | public void update(User user) throws Exception { 30 | Connection conn = null; 31 | PreparedStatement ps = null; 32 | try { 33 | conn = JdbcUtil.getConnection(); 34 | String sql = "update user set name=?,password=?,address=?,phoneNumber=? where username=? "; 35 | ps = conn.prepareStatement(sql); 36 | ps.setString(1, user.getName()); 37 | ps.setString(2, user.getPassword()); 38 | ps.setString(3, user.getAddress()); 39 | ps.setString(4, user.getPhoneNumber()); 40 | ps.setString(5, user.getUsername()); 41 | ps.executeUpdate(); 42 | } finally { 43 | JdbcUtil.free(null, ps, conn); 44 | } 45 | } 46 | 47 | /* 48 | public void delete(String username) throws Exception { 49 | Connection conn = null; 50 | PreparedStatement ps = null; 51 | try { 52 | conn = JdbcUtil.getConnection(); 53 | String sql = "delete from user where username=?"; 54 | ps = conn.prepareStatement(sql); 55 | ps.setString(1, username); 56 | ps.executeUpdate(); 57 | } finally { 58 | JdbcUtil.free(null, ps, conn); 59 | } 60 | }*/ 61 | 62 | public User findUserByUsername(String username) throws Exception { 63 | Connection conn = null; 64 | PreparedStatement ps = null; 65 | ResultSet rs = null; 66 | User user = null; 67 | try { 68 | conn = JdbcUtil.getConnection(); 69 | String sql = "select * from user where username=? "; 70 | ps = conn.prepareStatement(sql); 71 | ps.setString(1, username); 72 | rs = ps.executeQuery(); 73 | if (rs.next()) { 74 | user = new User(); 75 | user.setUsername(rs.getString(1)); 76 | user.setName(rs.getString(2)); 77 | user.setPassword(rs.getString(3)); 78 | user.setAddress(rs.getString(4)); 79 | user.setPhoneNumber(rs.getString(5)); 80 | 81 | } 82 | } finally { 83 | JdbcUtil.free(rs, ps, conn); 84 | } 85 | return user; 86 | } 87 | 88 | public User login(String username, String password) throws Exception { 89 | User user = findUserByUsername(username); 90 | if (user == null) return null; 91 | if (user.getPassword().equals(password)) { 92 | return user; 93 | } 94 | return null; 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /src/db.properties: -------------------------------------------------------------------------------- 1 | #driver=com.mysql.jdbc.Driver 2 | driver=com.mysql.cj.jdbc.Driver 3 | url=jdbc:mysql://localhost:3306/epmw?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8 4 | username=root 5 | password=1320062779 6 | 7 | -------------------------------------------------------------------------------- /src/filter/AdminLoginFilter.java: -------------------------------------------------------------------------------- 1 | package filter; 2 | 3 | import javax.servlet.*; 4 | import javax.servlet.annotation.WebFilter; 5 | import javax.servlet.http.HttpServletRequest; 6 | import javax.servlet.http.HttpServletResponse; 7 | import java.io.IOException; 8 | 9 | 10 | @WebFilter( 11 | urlPatterns = {"/goodManagerAdmin.jsp", 12 | "/UpdateGoods", 13 | "/ShowAllGoods", 14 | "/orderManagerAdmin.jsp", 15 | "/modifyAdmin.jsp", 16 | "/ModifyAdminInfo", 17 | "/ManageOrders", 18 | "/manageOrdersAdmin.jsp", 19 | "/OrderDetailAdmin", 20 | "/ChangeOrderStateAdmin", 21 | "/orderDetailAdmin.jsp", 22 | }) 23 | public class AdminLoginFilter implements Filter { 24 | @Override 25 | public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { 26 | HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest; 27 | HttpServletResponse httpServletResponse = (HttpServletResponse) servletResponse; 28 | 29 | if ("/ShowAllGoods".equals(httpServletRequest.getServletPath())) { 30 | if (!"admin".equals(httpServletRequest.getParameter("type"))) { 31 | filterChain.doFilter(servletRequest, servletResponse); 32 | return; 33 | } 34 | } 35 | if (httpServletRequest.getSession().getAttribute("admin") == null) { 36 | httpServletResponse.sendRedirect("admin.jsp"); 37 | } else { 38 | filterChain.doFilter(servletRequest, servletResponse); 39 | } 40 | 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/filter/EncodeFilter.java: -------------------------------------------------------------------------------- 1 | package filter; 2 | 3 | 4 | import javax.servlet.*; 5 | import javax.servlet.annotation.WebFilter; 6 | import javax.servlet.http.HttpServletRequest; 7 | import javax.servlet.http.HttpServletResponse; 8 | import java.io.IOException; 9 | 10 | @WebFilter(urlPatterns = "/*") 11 | public class EncodeFilter implements Filter { 12 | @Override 13 | public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { 14 | HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest; 15 | HttpServletResponse httpServletResponse = (HttpServletResponse) servletResponse; 16 | 17 | httpServletRequest.setCharacterEncoding("utf-8"); 18 | httpServletResponse.setCharacterEncoding("utf-8"); 19 | filterChain.doFilter(servletRequest, servletResponse); 20 | 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/filter/UserLoginFilter.java: -------------------------------------------------------------------------------- 1 | package filter; 2 | 3 | import javax.servlet.*; 4 | import javax.servlet.annotation.WebFilter; 5 | import javax.servlet.http.HttpServletRequest; 6 | import javax.servlet.http.HttpServletResponse; 7 | import java.io.IOException; 8 | 9 | @WebFilter( 10 | urlPatterns = {"/modify.jsp", 11 | "/ModifyUserInfo", 12 | "/ListMyOrders", 13 | "/listMyOrders.jsp", 14 | "/createOrder.jsp", 15 | "/CreateOrder", 16 | "/OrderDetail", 17 | "/orderDetail.jsp", 18 | "/ChangeOrderStatus" 19 | }) 20 | public class UserLoginFilter implements Filter { 21 | @Override 22 | public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { 23 | HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest; 24 | HttpServletResponse httpServletResponse = (HttpServletResponse) servletResponse; 25 | 26 | if (httpServletRequest.getSession().getAttribute("user") == null) { 27 | httpServletResponse.sendRedirect("login.jsp"); 28 | } else { 29 | filterChain.doFilter(servletRequest, servletResponse); 30 | } 31 | 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/servlet/AddCart.java: -------------------------------------------------------------------------------- 1 | package servlet; 2 | 3 | import dao.GoodsDao; 4 | import dao.OrderDao; 5 | import vo.Goods; 6 | import vo.Order; 7 | import vo.OrderItem; 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 | import java.io.IOException; 15 | 16 | @WebServlet("/AddCart") 17 | public class AddCart extends HttpServlet { 18 | @Override 19 | protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { 20 | doPost(req, resp); 21 | } 22 | 23 | @Override 24 | protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { 25 | Order order = (Order) req.getSession().getAttribute("order"); 26 | if (order == null) { 27 | order = new Order(); 28 | req.getSession().setAttribute("order", order); 29 | } 30 | 31 | String idStr = req.getParameter("id"); 32 | int id; 33 | try { 34 | id = Integer.parseInt(idStr); 35 | 36 | OrderDao orderDao = new OrderDao(); 37 | GoodsDao goodsDao = new GoodsDao(); 38 | Goods goods = goodsDao.findGoodsById(id); 39 | 40 | OrderItem orderItem = new OrderItem(); 41 | orderItem.setGoods(goods); 42 | orderItem.setCount(1); 43 | 44 | orderDao.addItem(order, orderItem); 45 | resp.getWriter().write("ok"); 46 | } catch (Exception e) { 47 | resp.getWriter().write("err"); 48 | } 49 | 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/servlet/ChangeCart.java: -------------------------------------------------------------------------------- 1 | package servlet; 2 | 3 | import dao.GoodsDao; 4 | import dao.OrderDao; 5 | import vo.Goods; 6 | import vo.Order; 7 | import vo.OrderItem; 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 | import java.io.IOException; 15 | 16 | @WebServlet("/ChangeCart") 17 | public class ChangeCart extends HttpServlet { 18 | @Override 19 | protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { 20 | doPost(req, resp); 21 | } 22 | 23 | @Override 24 | protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { 25 | String idStr = req.getParameter("id"); 26 | String countStr = req.getParameter("count"); 27 | Order order = (Order) req.getSession().getAttribute("order"); 28 | if (order == null) { 29 | order = new Order(); 30 | req.getSession().setAttribute("order", order); 31 | } 32 | int id, count; 33 | try { 34 | id = Integer.parseInt(idStr); 35 | count = Integer.parseInt(countStr); 36 | 37 | GoodsDao goodsDao = new GoodsDao(); 38 | Goods goods = goodsDao.findGoodsById(id); 39 | OrderDao orderDao = new OrderDao(); 40 | OrderItem orderItem = new OrderItem(); 41 | orderItem.setGoods(goods); 42 | orderItem.setCount(count); 43 | 44 | orderDao.changeItem(order, orderItem); 45 | resp.getWriter().write(String.valueOf(order.getPrice())); 46 | if (count == 0) { 47 | req.getRequestDispatcher("showCart.jsp").forward(req, resp); 48 | } 49 | } catch (Exception e) { 50 | resp.getWriter().write("err"); 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/servlet/ChangeOrderState.java: -------------------------------------------------------------------------------- 1 | package servlet; 2 | 3 | import dao.OrderDao; 4 | 5 | import javax.servlet.ServletException; 6 | import javax.servlet.annotation.WebServlet; 7 | import javax.servlet.http.HttpServlet; 8 | import javax.servlet.http.HttpServletRequest; 9 | import javax.servlet.http.HttpServletResponse; 10 | import java.io.IOException; 11 | 12 | @WebServlet("/ChangeOrderState") 13 | public class ChangeOrderState extends HttpServlet { 14 | @Override 15 | protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { 16 | doPost(req, resp); 17 | } 18 | 19 | @Override 20 | protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { 21 | String orderIdStr = req.getParameter("orderId"); 22 | String stateStr = req.getParameter("state"); 23 | 24 | int orderId, state; 25 | try { 26 | orderId = Integer.parseInt(orderIdStr); 27 | state = Integer.parseInt(stateStr); 28 | 29 | OrderDao dao = new OrderDao(); 30 | dao.changeOrderState(orderId, state); 31 | 32 | 33 | req.getRequestDispatcher("ListMyOrders").forward(req, resp); 34 | } catch (Exception e) { 35 | e.printStackTrace(); 36 | req.setAttribute("errMsg", "提交失败"); 37 | req.getRequestDispatcher("listMyOrders.jsp").forward(req, resp); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/servlet/CheckCode.java: -------------------------------------------------------------------------------- 1 | package servlet; 2 | 3 | import javax.imageio.ImageIO; 4 | import javax.servlet.ServletException; 5 | import javax.servlet.ServletOutputStream; 6 | import javax.servlet.annotation.WebServlet; 7 | import javax.servlet.http.HttpServlet; 8 | import javax.servlet.http.HttpServletRequest; 9 | import javax.servlet.http.HttpServletResponse; 10 | import javax.servlet.http.HttpSession; 11 | import java.awt.*; 12 | import java.awt.image.BufferedImage; 13 | import java.io.ByteArrayOutputStream; 14 | import java.io.IOException; 15 | 16 | @WebServlet("/CheckCode") 17 | public class CheckCode extends HttpServlet { 18 | public static boolean validateCode(HttpServletRequest req, String checkCode) { 19 | String rawCheckCode = (String) req.getSession().getAttribute("checkCode"); 20 | req.getSession().setAttribute("checkCode", null); 21 | return rawCheckCode != null && checkCode.equalsIgnoreCase(rawCheckCode); 22 | } 23 | 24 | @Override 25 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 26 | response.setContentType("image/jpeg"); 27 | HttpSession session = request.getSession(); 28 | int width = 60; 29 | int height = 20; 30 | // 设置浏览器不要缓存此图片 31 | response.setHeader("Pragma", "No-cache"); 32 | response.setHeader("Cache-Control", "no-cache"); 33 | response.setDateHeader("Expires", 0); 34 | // 创建内存图像并获得其图形上下文 35 | BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); 36 | Graphics g = image.getGraphics(); 37 | // 产生随机验证码 38 | // 定义验证码的字符表 39 | String chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; 40 | char[] rands = new char[4]; 41 | for (int i = 0; i < 4; i++) { 42 | int rand = (int) (Math.random() * chars.length()); 43 | rands[i] = chars.charAt(rand); 44 | } 45 | // 产生图像 46 | // 画背景 47 | g.setColor(new Color(0xDCDCDC)); 48 | g.fillRect(0, 0, width, height); 49 | // 随机产生120个干扰点 50 | for (int i = 0; i < 120; i++) { 51 | int x = (int) (Math.random() * width); 52 | int y = (int) (Math.random() * height); 53 | int red = (int) (Math.random() * 255); 54 | int green = (int) (Math.random() * 255); 55 | int blue = (int) (Math.random() * 255); 56 | g.setColor(new Color(red, green, blue)); 57 | g.drawOval(x, y, 1, 0); 58 | } 59 | g.setColor(Color.BLACK); 60 | g.setFont(new Font(null, Font.ITALIC | Font.BOLD, 18)); 61 | // 在不同的高度上输出验证码的不同字符 62 | g.drawString("" + rands[0], 1, 17); 63 | g.drawString("" + rands[1], 16, 15); 64 | g.drawString("" + rands[2], 31, 18); 65 | g.drawString("" + rands[3], 46, 16); 66 | g.dispose(); 67 | // 将图像输出到客户端 68 | ServletOutputStream sos = response.getOutputStream(); 69 | ByteArrayOutputStream baos = new ByteArrayOutputStream(); 70 | ImageIO.write(image, "JPEG", baos); 71 | byte[] buffer = baos.toByteArray(); 72 | response.setContentLength(buffer.length); 73 | sos.write(buffer); 74 | baos.close(); 75 | sos.close(); 76 | // 将验证码放到 session 中 77 | session.setAttribute("checkCode", new String(rands)); 78 | } 79 | 80 | @Override 81 | protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { 82 | doPost(req, resp); 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /src/servlet/CreateOrder.java: -------------------------------------------------------------------------------- 1 | package servlet; 2 | 3 | import dao.OrderDao; 4 | import utils.StringUtil; 5 | import vo.Order; 6 | import vo.User; 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 java.io.IOException; 14 | 15 | 16 | @WebServlet("/CreateOrder") 17 | public class CreateOrder extends HttpServlet { 18 | @Override 19 | protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { 20 | doPost(req, resp); 21 | } 22 | 23 | @Override 24 | protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { 25 | Order order = (Order) req.getSession().getAttribute("order"); 26 | if (order == null || order.getItems().size() == 0) { 27 | req.setAttribute("state", 2); 28 | req.getRequestDispatcher("createOrder.jsp").forward(req, resp); 29 | return; 30 | } 31 | 32 | OrderDao dao = new OrderDao(); 33 | try { 34 | String phone = req.getParameter("phone"); 35 | String name = req.getParameter("name"); 36 | String address = req.getParameter("address"); 37 | if (StringUtil.hasEmpty(phone, name, address)) { 38 | req.setAttribute("state", 3); 39 | req.setAttribute("errMsg", "请完善基收获信息!"); 40 | req.getRequestDispatcher("createOrder.jsp").forward(req, resp); 41 | return; 42 | } 43 | User user = (User) req.getSession().getAttribute("user"); 44 | 45 | User user1 = new User(); 46 | user1.setName(name); 47 | user1.setAddress(address); 48 | user1.setPhoneNumber(phone); 49 | user1.setUsername(user.getUsername()); 50 | 51 | 52 | dao.addOrder(order, user1); 53 | req.getSession().setAttribute("order", null); 54 | req.setAttribute("state", 1); 55 | req.getRequestDispatcher("createOrder.jsp").forward(req, resp); 56 | return; 57 | } catch (Exception e) { 58 | e.printStackTrace(); 59 | req.setAttribute("state", 3); 60 | req.setAttribute("errMsg", "创建订单失败"); 61 | req.getRequestDispatcher("createOrder.jsp").forward(req, resp); 62 | return; 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /src/servlet/ListMyOrders.java: -------------------------------------------------------------------------------- 1 | package servlet; 2 | 3 | import dao.OrderDao; 4 | import vo.Order; 5 | import vo.User; 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 | import java.io.IOException; 13 | import java.util.List; 14 | 15 | @WebServlet("/ListMyOrders") 16 | public class ListMyOrders extends HttpServlet { 17 | @Override 18 | protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { 19 | doPost(req, resp); 20 | } 21 | 22 | @Override 23 | protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { 24 | OrderDao dao = new OrderDao(); 25 | User user = (User) req.getSession().getAttribute("user"); 26 | try { 27 | List list = dao.queryOrdersWithoutItem(user); 28 | req.setAttribute("myOrders", list); 29 | req.getRequestDispatcher("listMyOrders.jsp").forward(req, resp); 30 | } catch (Exception e) { 31 | e.printStackTrace(); 32 | req.setAttribute("errMsg", "查询失败"); 33 | req.getRequestDispatcher("listMyOrders.jsp").forward(req, resp); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/servlet/Login.java: -------------------------------------------------------------------------------- 1 | package servlet; 2 | 3 | import dao.UserDao; 4 | import utils.StringUtil; 5 | import vo.User; 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 | import java.io.IOException; 13 | 14 | @WebServlet("/Login") 15 | public class Login extends HttpServlet { 16 | @Override 17 | protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { 18 | String username = req.getParameter("username"); 19 | String password = req.getParameter("password"); 20 | String checkCode = req.getParameter("checkCode"); 21 | 22 | req.setAttribute("username", username); 23 | req.setAttribute("password", password); 24 | 25 | if (StringUtil.isEmpty(username)) { 26 | req.setAttribute("errMsg", "用户名不能为空"); 27 | req.getRequestDispatcher("login.jsp").forward(req, resp); 28 | return; 29 | } 30 | if (StringUtil.isEmpty(password)) { 31 | req.setAttribute("errMsg", "密码不能为空"); 32 | req.getRequestDispatcher("login.jsp").forward(req, resp); 33 | return; 34 | } 35 | if (!CheckCode.validateCode(req, checkCode)) { 36 | req.setAttribute("errMsg", "验证码错误"); 37 | req.getRequestDispatcher("login.jsp").forward(req, resp); 38 | return; 39 | } 40 | UserDao dao = new UserDao(); 41 | try { 42 | User user = dao.login(username, password); 43 | if (user == null) { 44 | req.setAttribute("errMsg", "用户不存在或密码错误"); 45 | req.getRequestDispatcher("login.jsp").forward(req, resp); 46 | return; 47 | } 48 | req.getSession().setAttribute("user", user); 49 | req.getRequestDispatcher("main.jsp").forward(req, resp); 50 | return; 51 | } catch (Exception e) { 52 | e.printStackTrace(); 53 | req.setAttribute("errMsg", "登录错误"); 54 | } 55 | req.getRequestDispatcher("main.jsp").forward(req, resp); 56 | } 57 | 58 | @Override 59 | protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { 60 | doPost(req, resp); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/servlet/Logout.java: -------------------------------------------------------------------------------- 1 | package servlet; 2 | 3 | import javax.servlet.ServletException; 4 | import javax.servlet.annotation.WebServlet; 5 | import javax.servlet.http.HttpServlet; 6 | import javax.servlet.http.HttpServletRequest; 7 | import javax.servlet.http.HttpServletResponse; 8 | import java.io.IOException; 9 | 10 | @WebServlet("/Logout") 11 | public class Logout extends HttpServlet { 12 | @Override 13 | protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { 14 | String type = req.getParameter("type"); 15 | if ("admin".equals(type)) { 16 | req.getSession().setAttribute("admin", null); 17 | req.getRequestDispatcher("admin.jsp").forward(req, resp); 18 | } else { 19 | req.getSession().setAttribute("user", null); 20 | req.getRequestDispatcher("login.jsp").forward(req, resp); 21 | } 22 | 23 | } 24 | 25 | @Override 26 | protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { 27 | doPost(req, resp); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/servlet/ModifyUserInfo.java: -------------------------------------------------------------------------------- 1 | package servlet; 2 | 3 | import dao.UserDao; 4 | import utils.StringUtil; 5 | import vo.User; 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 | import java.io.IOException; 13 | 14 | @WebServlet("/ModifyUserInfo") 15 | public class ModifyUserInfo extends HttpServlet { 16 | @Override 17 | protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { 18 | String name = req.getParameter("name"); 19 | String password = req.getParameter("password"); 20 | String password2 = req.getParameter("password2"); 21 | String address = req.getParameter("address"); 22 | String phoneNumber = req.getParameter("phoneNumber"); 23 | 24 | if (StringUtil.hasEmpty(password, password2)) { 25 | req.setAttribute("errMsg", "密码不能为空"); 26 | req.getRequestDispatcher("modify.jsp").forward(req, resp); 27 | return; 28 | } 29 | if (!password.equals(password2)) { 30 | req.setAttribute("errMsg", "密码不一致"); 31 | req.getRequestDispatcher("modify.jsp").forward(req, resp); 32 | return; 33 | } 34 | 35 | User user = (User) req.getSession().getAttribute("user"); 36 | if (user == null) { 37 | req.setAttribute("errMsg", "请重新登录"); 38 | req.getRequestDispatcher("login.jsp").forward(req, resp); 39 | return; 40 | } 41 | 42 | user.setPhoneNumber(phoneNumber); 43 | user.setPassword(password); 44 | user.setAddress(address); 45 | user.setName(name); 46 | 47 | UserDao dao = new UserDao(); 48 | 49 | try { 50 | dao.update(user); 51 | req.setAttribute("errMsg", "个人信息修改成功,请重新登录!"); 52 | req.getSession().setAttribute("user", null); 53 | req.getRequestDispatcher("login.jsp").forward(req, resp); 54 | return; 55 | } catch (Exception e) { 56 | req.setAttribute("errMsg", "修改失败"); 57 | e.printStackTrace(); 58 | } 59 | req.getRequestDispatcher("modify.jsp").forward(req, resp); 60 | } 61 | 62 | @Override 63 | protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { 64 | doPost(req, resp); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/servlet/OrderDetail.java: -------------------------------------------------------------------------------- 1 | package servlet; 2 | 3 | import dao.OrderDao; 4 | import vo.Order; 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 | import java.io.IOException; 12 | 13 | @WebServlet("/OrderDetail") 14 | public class OrderDetail extends HttpServlet { 15 | 16 | @Override 17 | protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { 18 | doPost(req, resp); 19 | } 20 | 21 | @Override 22 | protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { 23 | String orderIdStr = req.getParameter("orderId"); 24 | int orderId; 25 | try { 26 | orderId = Integer.parseInt(orderIdStr); 27 | OrderDao dao = new OrderDao(); 28 | Order order = dao.getOrderById(orderId); 29 | req.setAttribute("order", order); 30 | req.getRequestDispatcher("orderDetail.jsp").forward(req, resp); 31 | } catch (Exception e) { 32 | e.printStackTrace(); 33 | req.setAttribute("errMsg", "获取参数错误"); 34 | req.getRequestDispatcher("orderDetail.jsp").forward(req, resp); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/servlet/Register.java: -------------------------------------------------------------------------------- 1 | package servlet; 2 | 3 | import dao.UserDao; 4 | import utils.StringUtil; 5 | import vo.User; 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 | import java.io.IOException; 13 | 14 | @WebServlet("/Register") 15 | public class Register extends HttpServlet { 16 | @Override 17 | protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { 18 | 19 | String username = req.getParameter("username"); 20 | String name = req.getParameter("name"); 21 | String password = req.getParameter("password"); 22 | String password2 = req.getParameter("password2"); 23 | String address = req.getParameter("address"); 24 | String phoneNumber = req.getParameter("phoneNumber"); 25 | String checkCode = req.getParameter("checkCode"); 26 | 27 | req.setAttribute("username", username); 28 | req.setAttribute("name", name); 29 | req.setAttribute("password", password); 30 | req.setAttribute("password2", password2); 31 | req.setAttribute("address", address); 32 | req.setAttribute("phoneNumber", phoneNumber); 33 | 34 | UserDao dao = new UserDao(); 35 | 36 | try { 37 | if (StringUtil.isEmpty(username)) { 38 | req.setAttribute("errMsg", "用户名不能为空"); 39 | req.getRequestDispatcher("register.jsp").forward(req, resp); 40 | return; 41 | } 42 | 43 | if (dao.findUserByUsername(username) != null) { 44 | req.setAttribute("errMsg", "用户名已经被注册"); 45 | req.getRequestDispatcher("register.jsp").forward(req, resp); 46 | return; 47 | } 48 | if (StringUtil.hasEmpty(password, password2)) { 49 | req.setAttribute("errMsg", "密码不能为空"); 50 | req.getRequestDispatcher("register.jsp").forward(req, resp); 51 | return; 52 | } 53 | if (!password.equals(password2)) { 54 | req.setAttribute("errMsg", "密码不一致"); 55 | req.getRequestDispatcher("register.jsp").forward(req, resp); 56 | return; 57 | } 58 | 59 | if (!CheckCode.validateCode(req, checkCode)) { 60 | req.setAttribute("errMsg", "验证码错误"); 61 | req.getRequestDispatcher("register.jsp").forward(req, resp); 62 | return; 63 | } 64 | 65 | 66 | User user = new User(); 67 | user.setUsername(username); 68 | user.setName(name); 69 | user.setPassword(password); 70 | user.setAddress(address); 71 | user.setPhoneNumber(phoneNumber); 72 | 73 | dao.register(user); 74 | req.setAttribute("isSuccess", "true"); 75 | } catch (Exception e) { 76 | req.setAttribute("errMsg", "出现错误"); 77 | e.printStackTrace(); 78 | } 79 | req.getRequestDispatcher("register.jsp").forward(req, resp); 80 | 81 | } 82 | 83 | @Override 84 | protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { 85 | doPost(req, resp); 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /src/servlet/ShowAllGoods.java: -------------------------------------------------------------------------------- 1 | package servlet; 2 | 3 | import dao.GoodsDao; 4 | import vo.Goods; 5 | import vo.Page; 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 | import java.io.IOException; 13 | 14 | @WebServlet("/ShowAllGoods") 15 | public class ShowAllGoods extends HttpServlet { 16 | @Override 17 | protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { 18 | doPost(req, resp); 19 | } 20 | 21 | @Override 22 | protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { 23 | int pageNum = 1; 24 | 25 | String pageNumStr = req.getParameter("pageNum"); 26 | try { 27 | pageNum = Integer.parseInt(pageNumStr); 28 | if (pageNum < 1) pageNum = 1; 29 | } catch (Exception e) { 30 | 31 | } 32 | GoodsDao dao = new GoodsDao(); 33 | //int count = 5; 34 | try { 35 | String type = req.getParameter("type"); 36 | if ("admin".equals(type)) { 37 | Page page = dao.queryGoodsByPage(pageNum, 5, Goods.ALL); 38 | req.setAttribute("page", page); 39 | req.getRequestDispatcher("goodManagerAdmin.jsp").forward(req, resp); 40 | } else { 41 | Page page = dao.queryGoodsByPage(pageNum, 15, Goods.SHELVE); 42 | req.setAttribute("page", page); 43 | req.getRequestDispatcher("main.jsp").forward(req, resp); 44 | } 45 | } catch (Exception e) { 46 | e.printStackTrace(); 47 | } 48 | 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/servlet/admin/ChangeGoodsState.java: -------------------------------------------------------------------------------- 1 | package servlet.admin; 2 | 3 | import dao.GoodsDao; 4 | 5 | import javax.servlet.ServletException; 6 | import javax.servlet.annotation.WebServlet; 7 | import javax.servlet.http.HttpServlet; 8 | import javax.servlet.http.HttpServletRequest; 9 | import javax.servlet.http.HttpServletResponse; 10 | import java.io.IOException; 11 | 12 | @WebServlet("/ChangeGoodsState") 13 | public class ChangeGoodsState extends HttpServlet { 14 | 15 | @Override 16 | protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { 17 | doPost(req, resp); 18 | } 19 | 20 | //ajax 调用 21 | @Override 22 | protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { 23 | String idStr = req.getParameter("id"); 24 | String stateStr = req.getParameter("state"); 25 | int id, state; 26 | try { 27 | id = Integer.parseInt(idStr); 28 | state = Integer.parseInt(stateStr); 29 | GoodsDao dao = new GoodsDao(); 30 | dao.changeState(id, state); 31 | resp.getWriter().write("ok"); 32 | } catch (Exception e) { 33 | resp.getWriter().write("err"); 34 | } 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/servlet/admin/ChangeOrderStateAdmin.java: -------------------------------------------------------------------------------- 1 | package servlet.admin; 2 | 3 | import dao.OrderDao; 4 | 5 | import javax.servlet.ServletException; 6 | import javax.servlet.annotation.WebServlet; 7 | import javax.servlet.http.HttpServlet; 8 | import javax.servlet.http.HttpServletRequest; 9 | import javax.servlet.http.HttpServletResponse; 10 | import java.io.IOException; 11 | 12 | @WebServlet("/ChangeOrderStateAdmin") 13 | public class ChangeOrderStateAdmin extends HttpServlet { 14 | @Override 15 | protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { 16 | doPost(req, resp); 17 | } 18 | 19 | //ajax 调用 20 | @Override 21 | protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { 22 | String orderIdStr = req.getParameter("orderId"); 23 | String stateStr = req.getParameter("state"); 24 | 25 | int orderId, state; 26 | try { 27 | orderId = Integer.parseInt(orderIdStr); 28 | state = Integer.parseInt(stateStr); 29 | 30 | OrderDao dao = new OrderDao(); 31 | dao.changeOrderState(orderId, state); 32 | 33 | 34 | resp.getWriter().write("ok"); 35 | } catch (Exception e) { 36 | e.printStackTrace(); 37 | resp.getWriter().write("err"); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/servlet/admin/LoginAdmin.java: -------------------------------------------------------------------------------- 1 | package servlet.admin; 2 | 3 | import dao.AdminDao; 4 | import vo.Admin; 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 | import java.io.IOException; 12 | 13 | @WebServlet("/LoginAdmin") 14 | public class LoginAdmin extends HttpServlet { 15 | @Override 16 | protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { 17 | doPost(req, resp); 18 | } 19 | 20 | @Override 21 | protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { 22 | String name = req.getParameter("name"); 23 | String password = req.getParameter("password"); 24 | 25 | AdminDao dao = new AdminDao(); 26 | try { 27 | Admin admin = dao.login(name, password); 28 | if (admin == null) { 29 | req.setAttribute("errMsg", "管理员不存在或密码错误"); 30 | req.getRequestDispatcher("admin.jsp").forward(req, resp); 31 | return; 32 | } 33 | 34 | req.getSession().setAttribute("admin", admin); 35 | req.getRequestDispatcher("ManageOrders").forward(req, resp); 36 | return; 37 | } catch (Exception e) { 38 | e.printStackTrace(); 39 | req.setAttribute("errMsg", "登录错误"); 40 | } 41 | req.getRequestDispatcher("admin.jsp").forward(req, resp); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/servlet/admin/ManageOrders.java: -------------------------------------------------------------------------------- 1 | package servlet.admin; 2 | 3 | import dao.OrderDao; 4 | import vo.Order; 5 | import vo.Page; 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 | import java.io.IOException; 13 | 14 | @WebServlet("/ManageOrders") 15 | public class ManageOrders extends HttpServlet { 16 | @Override 17 | protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { 18 | doPost(req, resp); 19 | } 20 | 21 | @Override 22 | protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { 23 | int pageNum = 1; 24 | int count = 8; 25 | String pageNumStr = req.getParameter("pageNum"); 26 | try { 27 | pageNum = Integer.parseInt(pageNumStr); 28 | if (pageNum < 1) pageNum = 1; 29 | } catch (Exception e) { 30 | } 31 | OrderDao dao = new OrderDao(); 32 | Page page = null; 33 | try { 34 | page = dao.queryOrdersByPage(pageNum, count); 35 | } catch (Exception e) { 36 | e.printStackTrace(); 37 | } 38 | req.setAttribute("page", page); 39 | req.getRequestDispatcher("orderManagerAdmin.jsp").forward(req, resp); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/servlet/admin/ModifyAdminInfo.java: -------------------------------------------------------------------------------- 1 | package servlet.admin; 2 | 3 | import dao.AdminDao; 4 | import utils.StringUtil; 5 | import vo.Admin; 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 | import java.io.IOException; 13 | import java.sql.SQLException; 14 | 15 | 16 | @WebServlet("/ModifyAdminInfo") 17 | public class ModifyAdminInfo extends HttpServlet { 18 | 19 | @Override 20 | protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { 21 | doPost(req, resp); 22 | } 23 | 24 | @Override 25 | protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { 26 | String password = req.getParameter("password"); 27 | String password2 = req.getParameter("password2"); 28 | 29 | if (StringUtil.hasEmpty(password, password2)) { 30 | req.setAttribute("errMsg", "密码不能为空"); 31 | req.getRequestDispatcher("modifyAdmin.jsp").forward(req, resp); 32 | return; 33 | } 34 | if (password.equals(password2)) { 35 | AdminDao dao = new AdminDao(); 36 | try { 37 | Admin admin = (Admin) req.getSession().getAttribute("admin"); 38 | dao.changePassword(admin, password); 39 | req.setAttribute("errMsg", "修改密码成功,请重新登录"); 40 | req.getSession().setAttribute("admin", null); 41 | req.getRequestDispatcher("admin.jsp").forward(req, resp); 42 | return; 43 | } catch (SQLException e) { 44 | req.setAttribute("errMsg", "修改密码失败"); 45 | req.getRequestDispatcher("modifyAdmin.jsp").forward(req, resp); 46 | return; 47 | } 48 | 49 | } else { 50 | req.setAttribute("errMsg", "密码不一致"); 51 | req.getRequestDispatcher("modifyAdmin.jsp").forward(req, resp); 52 | return; 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/servlet/admin/OrderDetailAdmin.java: -------------------------------------------------------------------------------- 1 | package servlet.admin; 2 | 3 | import dao.OrderDao; 4 | import vo.Order; 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 | import java.io.IOException; 12 | 13 | @WebServlet("/OrderDetailAdmin") 14 | public class OrderDetailAdmin extends HttpServlet { 15 | @Override 16 | protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { 17 | doPost(req, resp); 18 | } 19 | 20 | @Override 21 | protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { 22 | String orderIdStr = req.getParameter("orderId"); 23 | int orderId; 24 | try { 25 | orderId = Integer.parseInt(orderIdStr); 26 | OrderDao dao = new OrderDao(); 27 | Order order = dao.getOrderById(orderId); 28 | req.setAttribute("order", order); 29 | req.getRequestDispatcher("orderDetailAdmin.jsp").forward(req, resp); 30 | } catch (Exception e) { 31 | e.printStackTrace(); 32 | req.setAttribute("errMsg", "获取参数错误"); 33 | req.getRequestDispatcher("orderDetailAdmin.jsp").forward(req, resp); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/servlet/admin/UpdateGoods.java: -------------------------------------------------------------------------------- 1 | package servlet.admin; 2 | 3 | import com.oreilly.servlet.MultipartRequest; 4 | import com.oreilly.servlet.multipart.DefaultFileRenamePolicy; 5 | import com.oreilly.servlet.multipart.FileRenamePolicy; 6 | import dao.GoodsDao; 7 | import utils.StringUtil; 8 | import vo.Goods; 9 | 10 | import javax.servlet.ServletException; 11 | import javax.servlet.annotation.WebServlet; 12 | import javax.servlet.http.HttpServlet; 13 | import javax.servlet.http.HttpServletRequest; 14 | import javax.servlet.http.HttpServletResponse; 15 | import java.io.File; 16 | import java.io.IOException; 17 | import java.util.Enumeration; 18 | import java.util.HashMap; 19 | import java.util.Map; 20 | 21 | @WebServlet("/UpdateGoods") 22 | public class UpdateGoods extends HttpServlet { 23 | 24 | @Override 25 | public void init() throws ServletException { 26 | Map m1 = new HashMap<>(); 27 | this.getServletContext().setAttribute("ipsno", m1); 28 | } 29 | 30 | @Override 31 | protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { 32 | doPost(req, resp); 33 | } 34 | 35 | @Override 36 | protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { 37 | String saveDirectory = getServletContext().getRealPath("images"); 38 | File saveDir = new File(saveDirectory); 39 | if (!saveDir.exists()) { 40 | saveDir.mkdirs(); 41 | } 42 | int maxPostSize = 3 * 1024 * 1024; // 总上传大小限制:3M 43 | FileRenamePolicy policy = new DefaultFileRenamePolicy(); 44 | MultipartRequest multi = new MultipartRequest(req, saveDirectory, maxPostSize, "utf-8", policy); 45 | 46 | String type = multi.getParameter("type"); 47 | switch (type) { 48 | case "1": 49 | doAddGoods(multi, req, resp); 50 | return; 51 | case "2": 52 | doModifyGoods(multi, req, resp); 53 | } 54 | 55 | 56 | } 57 | 58 | //ajax 请求 59 | private void doModifyGoods(MultipartRequest multi, HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { 60 | //req.setAttribute("isOk", false); 61 | //req.setAttribute("isServletMsg", true); 62 | String name = multi.getParameter("name"); 63 | String priceStr = multi.getParameter("price"); 64 | String description = multi.getParameter("description"); 65 | String idStr = multi.getParameter("id"); 66 | 67 | req.setAttribute("id", idStr); 68 | req.setAttribute("name", name); 69 | req.setAttribute("price", priceStr); 70 | req.setAttribute("description", description); 71 | 72 | if (StringUtil.isEmpty(name)) { 73 | resp.getWriter().write("名字不能为空"); 74 | return; 75 | } 76 | 77 | if (StringUtil.isEmpty(description)) { 78 | resp.getWriter().write("描述不能为空"); 79 | return; 80 | } 81 | 82 | 83 | int id; 84 | float price; 85 | try { 86 | id = Integer.parseInt(idStr); 87 | GoodsDao dao = new GoodsDao(); 88 | Goods goods = dao.findGoodsById(id); 89 | if (goods != null) { 90 | try { 91 | price = Float.parseFloat(priceStr); 92 | goods.setName(name); 93 | goods.setPrice(price); 94 | goods.setDescription(description); 95 | 96 | Enumeration files = multi.getFileNames(); 97 | String filename = files.nextElement(); 98 | File file = multi.getFile(filename); 99 | 100 | if (file != null) { 101 | goods.setImage(file.getName()); 102 | dao.clearOldImg(getServletContext(), id); 103 | } 104 | dao.update(goods); 105 | resp.getWriter().write("ok"); 106 | return; 107 | } catch (Exception e) { 108 | resp.getWriter().write("请输入正确的价格"); 109 | return; 110 | } 111 | 112 | } else { 113 | resp.getWriter().write("修改信息失败:错误的id"); 114 | return; 115 | } 116 | } catch (Exception e) { 117 | resp.getWriter().write("修改信息失败:获取id失败"); 118 | return; 119 | } 120 | } 121 | 122 | //ajax 请求 123 | private void doAddGoods(MultipartRequest multi, HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { 124 | String name = multi.getParameter("name"); 125 | String priceStr = multi.getParameter("price"); 126 | String description = multi.getParameter("description"); 127 | 128 | req.setAttribute("name", name); 129 | req.setAttribute("price", priceStr); 130 | req.setAttribute("description", description); 131 | 132 | float price; 133 | 134 | req.setAttribute("isOk", false); 135 | if (StringUtil.isEmpty(name)) { 136 | resp.getWriter().write("名字不能为空"); 137 | return; 138 | } 139 | 140 | try { 141 | price = Float.parseFloat(priceStr); 142 | } catch (Exception e) { 143 | resp.getWriter().write("请输入正确的价格"); 144 | return; 145 | } 146 | 147 | if (StringUtil.isEmpty(description)) { 148 | resp.getWriter().write("描述不能为空"); 149 | return; 150 | } 151 | 152 | Goods goods = new Goods(); 153 | goods.setState(Goods.SHELVE); 154 | goods.setDescription(description); 155 | goods.setPrice(price); 156 | goods.setName(name); 157 | 158 | Enumeration files = multi.getFileNames(); 159 | 160 | String filename = files.nextElement(); 161 | File file = multi.getFile(filename); 162 | if (file != null) { 163 | goods.setImage(file.getName()); 164 | } 165 | GoodsDao dao = new GoodsDao(); 166 | try { 167 | dao.addGoods(goods); 168 | } catch (Exception e) { 169 | resp.getWriter().write("添加失败:" + e); 170 | e.printStackTrace(); 171 | return; 172 | } 173 | 174 | resp.getWriter().write("ok"); 175 | } 176 | 177 | /* 178 | private void doModifyGoods(MultipartRequest multi, HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { 179 | req.setAttribute("isOk", false); 180 | req.setAttribute("isServletMsg", true); 181 | String name = multi.getParameter("name"); 182 | String priceStr = multi.getParameter("price"); 183 | String description = multi.getParameter("description"); 184 | String idStr = multi.getParameter("id"); 185 | 186 | req.setAttribute("id", idStr); 187 | req.setAttribute("name", name); 188 | req.setAttribute("price", priceStr); 189 | req.setAttribute("description", description); 190 | 191 | if (StringUtil.isEmpty(name)) { 192 | req.setAttribute("errMsg", "名字不能为空"); 193 | req.getRequestDispatcher("modifyGoods.jsp").forward(req, resp); 194 | return; 195 | } 196 | 197 | if (StringUtil.isEmpty(description)) { 198 | req.setAttribute("errMsg", "描述不能为空"); 199 | req.getRequestDispatcher("modifyGoods.jsp").forward(req, resp); 200 | return; 201 | } 202 | 203 | 204 | int id; 205 | float price; 206 | try { 207 | id = Integer.parseInt(idStr); 208 | GoodsDao dao = new GoodsDao(); 209 | Goods goods = dao.findGoodsById(id); 210 | if (goods != null) { 211 | try { 212 | price = Float.parseFloat(priceStr); 213 | goods.setName(name); 214 | goods.setPrice(price); 215 | goods.setDescription(description); 216 | 217 | Enumeration files = multi.getFileNames(); 218 | String filename = files.nextElement(); 219 | File file = multi.getFile(filename); 220 | 221 | if (file != null) { 222 | goods.setImage(file.getName()); 223 | dao.clearOldImg(getServletContext(), id); 224 | } 225 | dao.update(goods); 226 | req.setAttribute("isOk", true); 227 | req.getRequestDispatcher("modifyGoods.jsp").forward(req, resp); 228 | return; 229 | } catch (Exception e) { 230 | req.setAttribute("errMsg", "请输入正确的价格"); 231 | req.getRequestDispatcher("modifyGoods.jsp").forward(req, resp); 232 | return; 233 | } 234 | 235 | } else { 236 | req.setAttribute("errMsg", "修改信息失败:错误的id"); 237 | req.getRequestDispatcher("ShowAllGoods").forward(req, resp); 238 | } 239 | } catch (Exception e) { 240 | req.setAttribute("errMsg", "修改信息失败:获取id失败"); 241 | req.getRequestDispatcher("ShowAllGoods").forward(req, resp); 242 | return; 243 | } 244 | return; 245 | } 246 | 247 | 248 | private void doAddGoods(MultipartRequest multi, HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { 249 | String name = multi.getParameter("name"); 250 | String priceStr = multi.getParameter("price"); 251 | String description = multi.getParameter("description"); 252 | 253 | req.setAttribute("name", name); 254 | req.setAttribute("price", priceStr); 255 | req.setAttribute("description", description); 256 | 257 | float price; 258 | 259 | req.setAttribute("isOk", false); 260 | if (StringUtil.isEmpty(name)) { 261 | req.setAttribute("errMsg", "名字不能为空"); 262 | req.getRequestDispatcher("addGoods.jsp").forward(req, resp); 263 | return; 264 | } 265 | 266 | try { 267 | price = Float.parseFloat(priceStr); 268 | } catch (Exception e) { 269 | req.setAttribute("errMsg", "请输入正确的价格"); 270 | req.getRequestDispatcher("addGoods.jsp").forward(req, resp); 271 | return; 272 | } 273 | 274 | if (StringUtil.isEmpty(description)) { 275 | req.setAttribute("errMsg", "描述不能为空"); 276 | req.getRequestDispatcher("addGoods.jsp").forward(req, resp); 277 | return; 278 | } 279 | 280 | Goods goods = new Goods(); 281 | goods.setState(Goods.SHELVE); 282 | goods.setDescription(description); 283 | goods.setPrice(price); 284 | goods.setName(name); 285 | 286 | Enumeration files = multi.getFileNames(); 287 | 288 | String filename = files.nextElement(); 289 | File file = multi.getFile(filename); 290 | if (file != null) { 291 | goods.setImage(file.getName()); 292 | } 293 | GoodsDao dao = new GoodsDao(); 294 | try { 295 | dao.addGoods(goods); 296 | } catch (Exception e) { 297 | req.setAttribute("errMsg", "添加失败"); 298 | req.getRequestDispatcher("addGoods.jsp").forward(req, resp); 299 | e.printStackTrace(); 300 | return; 301 | } 302 | 303 | req.setAttribute("isOk", true); 304 | req.getRequestDispatcher("addGoods.jsp").forward(req, resp); 305 | } 306 | 307 | */ 308 | } 309 | -------------------------------------------------------------------------------- /src/utils/JdbcUtil.java: -------------------------------------------------------------------------------- 1 | package utils; 2 | 3 | import java.sql.*; 4 | import java.util.Properties; 5 | 6 | public final class JdbcUtil { 7 | private static String driver; 8 | private static String url; 9 | private static String user; 10 | private static String password; 11 | private static Properties pr = new Properties(); 12 | 13 | static { 14 | try { 15 | pr.load(JdbcUtil.class.getClassLoader().getResourceAsStream( 16 | "db.properties")); 17 | driver = pr.getProperty("driver"); 18 | url = pr.getProperty("url"); 19 | user = pr.getProperty("username"); 20 | password = pr.getProperty("password"); 21 | Class.forName(driver); 22 | } catch (Exception e) { 23 | throw new ExceptionInInitializerError(e); 24 | } 25 | } 26 | 27 | private JdbcUtil() { 28 | } 29 | 30 | public static Connection getConnection() throws SQLException { 31 | return DriverManager.getConnection(url, user, password); 32 | } 33 | 34 | public static void free(ResultSet rs, Statement st, Connection conn) { 35 | try { 36 | if (rs != null) 37 | rs.close(); 38 | } catch (SQLException e) { 39 | e.printStackTrace(); 40 | } finally { 41 | try { 42 | if (st != null) 43 | st.close(); 44 | } catch (SQLException e) { 45 | e.printStackTrace(); 46 | } finally { 47 | if (conn != null) 48 | try { 49 | conn.close(); 50 | } catch (SQLException e) { 51 | e.printStackTrace(); 52 | } 53 | } 54 | } 55 | } 56 | } -------------------------------------------------------------------------------- /src/utils/StringUtil.java: -------------------------------------------------------------------------------- 1 | package utils; 2 | 3 | public class StringUtil { 4 | public static boolean isEmpty(String str) { 5 | return str == null || str.trim().isEmpty(); 6 | } 7 | 8 | public static boolean hasEmpty(String... str) { 9 | if (str == null) return true; 10 | for (String s : str) 11 | if (isEmpty(s)) return true; 12 | return false; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/vo/Admin.java: -------------------------------------------------------------------------------- 1 | package vo; 2 | 3 | public class Admin { 4 | private String name; 5 | private String password; 6 | 7 | public String getName() { 8 | return name; 9 | } 10 | 11 | public void setName(String name) { 12 | this.name = name; 13 | } 14 | 15 | public String getPassword() { 16 | return password; 17 | } 18 | 19 | public void setPassword(String password) { 20 | this.password = password; 21 | } 22 | 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/vo/Goods.java: -------------------------------------------------------------------------------- 1 | package vo; 2 | 3 | public class Goods { 4 | public static final int SHELVE = 1, OFF_SHELVE = 0, ALL = 2; 5 | private int id, state; 6 | private String name, description, image = "default.jpg"; 7 | private float price; 8 | 9 | public int getState() { 10 | return state; 11 | } 12 | 13 | public void setState(int state) { 14 | this.state = state; 15 | } 16 | 17 | public int getId() { 18 | return id; 19 | } 20 | 21 | public void setId(int id) { 22 | this.id = id; 23 | } 24 | 25 | public String getName() { 26 | return name; 27 | } 28 | 29 | public void setName(String name) { 30 | this.name = name; 31 | } 32 | 33 | public String getDescription() { 34 | return description; 35 | } 36 | 37 | public void setDescription(String description) { 38 | this.description = description; 39 | } 40 | 41 | public String getImage() { 42 | return image; 43 | } 44 | 45 | public void setImage(String image) { 46 | this.image = image; 47 | } 48 | 49 | public float getPrice() { 50 | return price; 51 | } 52 | 53 | public void setPrice(float price) { 54 | this.price = price; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/vo/Order.java: -------------------------------------------------------------------------------- 1 | package vo; 2 | 3 | import java.sql.Timestamp; 4 | import java.util.ArrayList; 5 | import java.util.List; 6 | 7 | public class Order { 8 | private List items = new ArrayList<>(); 9 | private int id, state; 10 | /** 11 | * state 12 | * 0 未付款 13 | * 1 待派送 14 | * 2 正在派送 15 | * 3 已签收 16 | */ 17 | private float price; 18 | private Timestamp time; 19 | private String name, address, phone; 20 | 21 | public String getAddress() { 22 | return address; 23 | } 24 | 25 | public void setAddress(String address) { 26 | this.address = address; 27 | } 28 | 29 | public String getPhone() { 30 | return phone; 31 | } 32 | 33 | public void setPhone(String phone) { 34 | this.phone = phone; 35 | } 36 | 37 | public String getName() { 38 | return name; 39 | } 40 | 41 | public void setName(String name) { 42 | this.name = name; 43 | } 44 | 45 | public List getItems() { 46 | return items; 47 | } 48 | 49 | 50 | public void updatePrice() { 51 | float price = 0; 52 | for (OrderItem item : items) { 53 | price += item.getPrice(); 54 | } 55 | this.price = price; 56 | } 57 | 58 | public int getId() { 59 | return id; 60 | } 61 | 62 | public void setId(int id) { 63 | this.id = id; 64 | } 65 | 66 | public int getState() { 67 | return state; 68 | } 69 | 70 | public void setState(int state) { 71 | this.state = state; 72 | } 73 | 74 | public float getPrice() { 75 | return price; 76 | } 77 | 78 | public void setPrice(float price) { 79 | this.price = price; 80 | } 81 | 82 | public Timestamp getTime() { 83 | return time; 84 | } 85 | 86 | public void setTime(Timestamp time) { 87 | this.time = time; 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /src/vo/OrderItem.java: -------------------------------------------------------------------------------- 1 | package vo; 2 | 3 | public class OrderItem { 4 | 5 | private Goods goods; 6 | private int count = 1; 7 | private float price; 8 | 9 | 10 | public Goods getGoods() { 11 | return goods; 12 | } 13 | 14 | public void setGoods(Goods goods) { 15 | this.goods = goods; 16 | price = goods.getPrice() * count; 17 | } 18 | 19 | public int getCount() { 20 | return count; 21 | } 22 | 23 | public void setCount(int count) { 24 | this.count = count; 25 | if (goods != null) price = goods.getPrice() * count; 26 | } 27 | 28 | public float getPrice() { 29 | return price; 30 | } 31 | 32 | public void setPrice(float price) { 33 | this.price = price; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/vo/Page.java: -------------------------------------------------------------------------------- 1 | package vo; 2 | 3 | import java.util.List; 4 | 5 | public class Page { 6 | private int allPageNum, currentPageNum, count; 7 | private List list; 8 | 9 | public int getAllPageNum() { 10 | return allPageNum; 11 | } 12 | 13 | public void setAllPageNum(int allPageNum) { 14 | this.allPageNum = allPageNum; 15 | } 16 | 17 | public int getCurrentPageNum() { 18 | return currentPageNum; 19 | } 20 | 21 | public void setCurrentPageNum(int currentPageNum) { 22 | this.currentPageNum = currentPageNum; 23 | } 24 | 25 | public int getCount() { 26 | return count; 27 | } 28 | 29 | public void setCount(int count) { 30 | this.count = count; 31 | } 32 | 33 | public List getList() { 34 | return list; 35 | } 36 | 37 | public void setList(List list) { 38 | this.list = list; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/vo/User.java: -------------------------------------------------------------------------------- 1 | package vo; 2 | 3 | public class User { 4 | private String username, name, password, address, phoneNumber; 5 | 6 | public String getUsername() { 7 | return username; 8 | } 9 | 10 | public void setUsername(String username) { 11 | this.username = username; 12 | } 13 | 14 | public String getName() { 15 | return name; 16 | } 17 | 18 | public void setName(String name) { 19 | this.name = name; 20 | } 21 | 22 | public String getPassword() { 23 | return password; 24 | } 25 | 26 | public void setPassword(String password) { 27 | this.password = password; 28 | } 29 | 30 | public String getAddress() { 31 | return address; 32 | } 33 | 34 | public void setAddress(String address) { 35 | this.address = address; 36 | } 37 | 38 | public String getPhoneNumber() { 39 | return phoneNumber; 40 | } 41 | 42 | public void setPhoneNumber(String phoneNumber) { 43 | this.phoneNumber = phoneNumber; 44 | } 45 | } -------------------------------------------------------------------------------- /web/WEB-INF/lib/cos.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Coyamo/EPMW/332304b32b2975769e5fea770f7644c5dd2d9dbd/web/WEB-INF/lib/cos.jar -------------------------------------------------------------------------------- /web/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | /main.jsp 8 | 9 | -------------------------------------------------------------------------------- /web/admin.jsp: -------------------------------------------------------------------------------- 1 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 2 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> 3 | 4 | 5 | 管理员登录 6 | 17 | 18 | 23 | 24 | 25 | 26 | 27 | 28 |
29 |
30 |
31 |
32 |
33 |
后台管理
34 |
登录
35 |
36 |
37 |
38 | 39 | 40 | 46 | 47 | 48 | 49 | 55 | 56 | 57 |
41 |
42 | 43 | 44 |
45 |
50 |
51 | 52 | 53 |
54 |
58 |
59 | 61 |
62 |
63 | 64 |
65 |
66 |
67 | 68 | 69 | -------------------------------------------------------------------------------- /web/createOrder.jsp: -------------------------------------------------------------------------------- 1 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 2 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> 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 |
序号菜品名称菜品价格数量小计
${status.index+1}${item.goods.name}${item.goods.price} ${item.count}${item.price}
39 |
40 |
41 |
42 |
43 | 44 | 合计:${sessionScope.order.price==null?0:sessionScope.order.price}元 46 |
47 |
48 |
49 | 50 |
51 |
52 |
53 |
54 | 55 | 57 |
58 | 59 |
60 | 61 | 62 |
63 | 64 |
65 | 66 | 68 |
69 | 70 | 72 | 73 |
74 |
75 |
76 |
77 | 78 | 79 | 84 | 85 | 86 | 87 | 88 | 95 | 96 | 97 | 98 | 106 | 107 | 108 | 109 | 110 | -------------------------------------------------------------------------------- /web/css/default.css: -------------------------------------------------------------------------------- 1 | .center-div-out { 2 | position: fixed; 3 | left: -100%; 4 | right: 100%; 5 | top: 0; 6 | bottom: 0; 7 | text-align: center; 8 | font-size: 0; 9 | } 10 | 11 | .center-div-out:after { 12 | content: ""; 13 | display: inline-block; 14 | vertical-align: middle; 15 | height: 100%; 16 | width: 0; 17 | } 18 | 19 | .center-div-in { 20 | display: inline-block; 21 | *display: inline; 22 | *zoom: 1; 23 | vertical-align: middle; 24 | position: relative; 25 | right: -100%; 26 | } -------------------------------------------------------------------------------- /web/fonts/roboto/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /web/fonts/roboto/Roboto-Black.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Coyamo/EPMW/332304b32b2975769e5fea770f7644c5dd2d9dbd/web/fonts/roboto/Roboto-Black.woff -------------------------------------------------------------------------------- /web/fonts/roboto/Roboto-Black.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Coyamo/EPMW/332304b32b2975769e5fea770f7644c5dd2d9dbd/web/fonts/roboto/Roboto-Black.woff2 -------------------------------------------------------------------------------- /web/fonts/roboto/Roboto-BlackItalic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Coyamo/EPMW/332304b32b2975769e5fea770f7644c5dd2d9dbd/web/fonts/roboto/Roboto-BlackItalic.woff -------------------------------------------------------------------------------- /web/fonts/roboto/Roboto-BlackItalic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Coyamo/EPMW/332304b32b2975769e5fea770f7644c5dd2d9dbd/web/fonts/roboto/Roboto-BlackItalic.woff2 -------------------------------------------------------------------------------- /web/fonts/roboto/Roboto-Bold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Coyamo/EPMW/332304b32b2975769e5fea770f7644c5dd2d9dbd/web/fonts/roboto/Roboto-Bold.woff -------------------------------------------------------------------------------- /web/fonts/roboto/Roboto-Bold.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Coyamo/EPMW/332304b32b2975769e5fea770f7644c5dd2d9dbd/web/fonts/roboto/Roboto-Bold.woff2 -------------------------------------------------------------------------------- /web/fonts/roboto/Roboto-BoldItalic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Coyamo/EPMW/332304b32b2975769e5fea770f7644c5dd2d9dbd/web/fonts/roboto/Roboto-BoldItalic.woff -------------------------------------------------------------------------------- /web/fonts/roboto/Roboto-BoldItalic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Coyamo/EPMW/332304b32b2975769e5fea770f7644c5dd2d9dbd/web/fonts/roboto/Roboto-BoldItalic.woff2 -------------------------------------------------------------------------------- /web/fonts/roboto/Roboto-Light.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Coyamo/EPMW/332304b32b2975769e5fea770f7644c5dd2d9dbd/web/fonts/roboto/Roboto-Light.woff -------------------------------------------------------------------------------- /web/fonts/roboto/Roboto-Light.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Coyamo/EPMW/332304b32b2975769e5fea770f7644c5dd2d9dbd/web/fonts/roboto/Roboto-Light.woff2 -------------------------------------------------------------------------------- /web/fonts/roboto/Roboto-LightItalic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Coyamo/EPMW/332304b32b2975769e5fea770f7644c5dd2d9dbd/web/fonts/roboto/Roboto-LightItalic.woff -------------------------------------------------------------------------------- /web/fonts/roboto/Roboto-LightItalic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Coyamo/EPMW/332304b32b2975769e5fea770f7644c5dd2d9dbd/web/fonts/roboto/Roboto-LightItalic.woff2 -------------------------------------------------------------------------------- /web/fonts/roboto/Roboto-Medium.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Coyamo/EPMW/332304b32b2975769e5fea770f7644c5dd2d9dbd/web/fonts/roboto/Roboto-Medium.woff -------------------------------------------------------------------------------- /web/fonts/roboto/Roboto-Medium.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Coyamo/EPMW/332304b32b2975769e5fea770f7644c5dd2d9dbd/web/fonts/roboto/Roboto-Medium.woff2 -------------------------------------------------------------------------------- /web/fonts/roboto/Roboto-MediumItalic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Coyamo/EPMW/332304b32b2975769e5fea770f7644c5dd2d9dbd/web/fonts/roboto/Roboto-MediumItalic.woff -------------------------------------------------------------------------------- /web/fonts/roboto/Roboto-MediumItalic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Coyamo/EPMW/332304b32b2975769e5fea770f7644c5dd2d9dbd/web/fonts/roboto/Roboto-MediumItalic.woff2 -------------------------------------------------------------------------------- /web/fonts/roboto/Roboto-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Coyamo/EPMW/332304b32b2975769e5fea770f7644c5dd2d9dbd/web/fonts/roboto/Roboto-Regular.woff -------------------------------------------------------------------------------- /web/fonts/roboto/Roboto-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Coyamo/EPMW/332304b32b2975769e5fea770f7644c5dd2d9dbd/web/fonts/roboto/Roboto-Regular.woff2 -------------------------------------------------------------------------------- /web/fonts/roboto/Roboto-RegularItalic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Coyamo/EPMW/332304b32b2975769e5fea770f7644c5dd2d9dbd/web/fonts/roboto/Roboto-RegularItalic.woff -------------------------------------------------------------------------------- /web/fonts/roboto/Roboto-RegularItalic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Coyamo/EPMW/332304b32b2975769e5fea770f7644c5dd2d9dbd/web/fonts/roboto/Roboto-RegularItalic.woff2 -------------------------------------------------------------------------------- /web/fonts/roboto/Roboto-Thin.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Coyamo/EPMW/332304b32b2975769e5fea770f7644c5dd2d9dbd/web/fonts/roboto/Roboto-Thin.woff -------------------------------------------------------------------------------- /web/fonts/roboto/Roboto-Thin.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Coyamo/EPMW/332304b32b2975769e5fea770f7644c5dd2d9dbd/web/fonts/roboto/Roboto-Thin.woff2 -------------------------------------------------------------------------------- /web/fonts/roboto/Roboto-ThinItalic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Coyamo/EPMW/332304b32b2975769e5fea770f7644c5dd2d9dbd/web/fonts/roboto/Roboto-ThinItalic.woff -------------------------------------------------------------------------------- /web/fonts/roboto/Roboto-ThinItalic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Coyamo/EPMW/332304b32b2975769e5fea770f7644c5dd2d9dbd/web/fonts/roboto/Roboto-ThinItalic.woff2 -------------------------------------------------------------------------------- /web/goodManagerAdmin.jsp: -------------------------------------------------------------------------------- 1 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 2 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> 3 | 4 | 5 | 15 | 16 | 21 | 22 | 菜品管理 23 | 24 | 25 | 26 |
27 | 155 |
156 |

菜品管理

157 |
158 |
159 |
160 | 161 |
162 | 163 | 164 | 第一页 165 | 166 | 167 | 第一页 168 | 169 | 170 | 171 | 172 | 173 | 上一页 175 | 176 | 177 | 上一页 179 | 180 | 181 | ${requestScope.page.currentPageNum}/${requestScope.page.allPageNum}页 183 | 184 | 185 | 下一页 187 | 188 | 189 | 下一页 191 | 192 | 193 | 194 | 195 | 196 | 最后一页 197 | 198 | 199 | 最后一页 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 | 230 | 231 | 232 | 242 | 243 | 244 | 245 | 246 |
封面菜名价格简介编辑操作
${goods.image}${goods.name}${goods.price}${goods.description} 227 | 修改信息 229 | 234 | 235 | 上架 236 | 237 | 238 | 下架 239 | 240 | 241 |
247 |
248 |
249 | 252 |
253 |
添加菜品
254 |
255 | 256 | 257 |
258 | 259 | 260 |
261 |
262 | 263 | 264 |
265 |
266 | 267 | 268 |
269 |
270 | 271 | 273 |
274 |
275 |
276 | 277 | 280 |
281 |
282 |
283 |
修改菜品
284 |
285 | 286 | 287 |
288 | 289 | 290 |
291 |
292 | 293 | 294 |
295 |
296 | 297 | 298 |
299 |
300 | 301 | 303 |
304 |
305 |
306 | 307 | 309 |
310 |
311 | 312 | 319 |
320 | 321 | 322 | -------------------------------------------------------------------------------- /web/header.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html;charset=UTF-8" %> 2 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 3 | 4 | 7 | 8 | 9 | 10 | 11 | 12 |
13 |
14 | 伊品美味 15 |
16 | 17 | 18 | 19 | 20 |
21 | 22 | ${sessionScope.user.username} 23 |
24 | 我的订单 25 | 修改个人资料 26 | 退出登录 27 |
28 | 29 | 登录 30 | 注册 31 | 32 |
33 | 商品浏览 34 | 我的购物车 35 |
36 |
37 | 38 | -------------------------------------------------------------------------------- /web/headerAdmin.jsp: -------------------------------------------------------------------------------- 1 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 2 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 |
14 | 伊品美味网络订餐管理系统 15 |
16 | 17 | 19 | 20 |
21 | 22 |
23 | 菜品管理 24 | 订单管理 25 | 修改密码 26 |
27 |
28 |
29 | 30 | 31 | -------------------------------------------------------------------------------- /web/icons/material-icons/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Attribution 4.0 International 2 | 3 | ======================================================================= 4 | 5 | Creative Commons Corporation ("Creative Commons") is not a law firm and 6 | does not provide legal services or legal advice. Distribution of 7 | Creative Commons public licenses does not create a lawyer-client or 8 | other relationship. Creative Commons makes its licenses and related 9 | information available on an "as-is" basis. Creative Commons gives no 10 | warranties regarding its licenses, any material licensed under their 11 | terms and conditions, or any related information. Creative Commons 12 | disclaims all liability for damages resulting from their use to the 13 | fullest extent possible. 14 | 15 | Using Creative Commons Public Licenses 16 | 17 | Creative Commons public licenses provide a standard set of terms and 18 | conditions that creators and other rights holders may use to share 19 | original works of authorship and other material subject to copyright 20 | and certain other rights specified in the public license below. The 21 | following considerations are for informational purposes only, are not 22 | exhaustive, and do not form part of our licenses. 23 | 24 | Considerations for licensors: Our public licenses are 25 | intended for use by those authorized to give the public 26 | permission to use material in ways otherwise restricted by 27 | copyright and certain other rights. Our licenses are 28 | irrevocable. Licensors should read and understand the terms 29 | and conditions of the license they choose before applying it. 30 | Licensors should also secure all rights necessary before 31 | applying our licenses so that the public can reuse the 32 | material as expected. Licensors should clearly mark any 33 | material not subject to the license. This includes other CC- 34 | licensed material, or material used under an exception or 35 | limitation to copyright. More considerations for licensors: 36 | wiki.creativecommons.org/Considerations_for_licensors 37 | 38 | Considerations for the public: By using one of our public 39 | licenses, a licensor grants the public permission to use the 40 | licensed material under specified terms and conditions. If 41 | the licensor's permission is not necessary for any reason--for 42 | example, because of any applicable exception or limitation to 43 | copyright--then that use is not regulated by the license. Our 44 | licenses grant only permissions under copyright and certain 45 | other rights that a licensor has authority to grant. Use of 46 | the licensed material may still be restricted for other 47 | reasons, including because others have copyright or other 48 | rights in the material. A licensor may make special requests, 49 | such as asking that all changes be marked or described. 50 | Although not required by our licenses, you are encouraged to 51 | respect those requests where reasonable. More_considerations 52 | for the public: 53 | wiki.creativecommons.org/Considerations_for_licensees 54 | 55 | ======================================================================= 56 | 57 | Creative Commons Attribution 4.0 International Public License 58 | 59 | By exercising the Licensed Rights (defined below), You accept and agree 60 | to be bound by the terms and conditions of this Creative Commons 61 | Attribution 4.0 International Public License ("Public License"). To the 62 | extent this Public License may be interpreted as a contract, You are 63 | granted the Licensed Rights in consideration of Your acceptance of 64 | these terms and conditions, and the Licensor grants You such rights in 65 | consideration of benefits the Licensor receives from making the 66 | Licensed Material available under these terms and conditions. 67 | 68 | 69 | Section 1 -- Definitions. 70 | 71 | a. Adapted Material means material subject to Copyright and Similar 72 | Rights that is derived from or based upon the Licensed Material 73 | and in which the Licensed Material is translated, altered, 74 | arranged, transformed, or otherwise modified in a manner requiring 75 | permission under the Copyright and Similar Rights held by the 76 | Licensor. For purposes of this Public License, where the Licensed 77 | Material is a musical work, performance, or sound recording, 78 | Adapted Material is always produced where the Licensed Material is 79 | synched in timed relation with a moving image. 80 | 81 | b. Adapter's License means the license You apply to Your Copyright 82 | and Similar Rights in Your contributions to Adapted Material in 83 | accordance with the terms and conditions of this Public License. 84 | 85 | c. Copyright and Similar Rights means copyright and/or similar rights 86 | closely related to copyright including, without limitation, 87 | performance, broadcast, sound recording, and Sui Generis Database 88 | Rights, without regard to how the rights are labeled or 89 | categorized. For purposes of this Public License, the rights 90 | specified in Section 2(b)(1)-(2) are not Copyright and Similar 91 | Rights. 92 | 93 | d. Effective Technological Measures means those measures that, in the 94 | absence of proper authority, may not be circumvented under laws 95 | fulfilling obligations under Article 11 of the WIPO Copyright 96 | Treaty adopted on December 20, 1996, and/or similar international 97 | agreements. 98 | 99 | e. Exceptions and Limitations means fair use, fair dealing, and/or 100 | any other exception or limitation to Copyright and Similar Rights 101 | that applies to Your use of the Licensed Material. 102 | 103 | f. Licensed Material means the artistic or literary work, database, 104 | or other material to which the Licensor applied this Public 105 | License. 106 | 107 | g. Licensed Rights means the rights granted to You subject to the 108 | terms and conditions of this Public License, which are limited to 109 | all Copyright and Similar Rights that apply to Your use of the 110 | Licensed Material and that the Licensor has authority to license. 111 | 112 | h. Licensor means the individual(s) or entity(ies) granting rights 113 | under this Public License. 114 | 115 | i. Share means to provide material to the public by any means or 116 | process that requires permission under the Licensed Rights, such 117 | as reproduction, public display, public performance, distribution, 118 | dissemination, communication, or importation, and to make material 119 | available to the public including in ways that members of the 120 | public may access the material from a place and at a time 121 | individually chosen by them. 122 | 123 | j. Sui Generis Database Rights means rights other than copyright 124 | resulting from Directive 96/9/EC of the European Parliament and of 125 | the Council of 11 March 1996 on the legal protection of databases, 126 | as amended and/or succeeded, as well as other essentially 127 | equivalent rights anywhere in the world. 128 | 129 | k. You means the individual or entity exercising the Licensed Rights 130 | under this Public License. Your has a corresponding meaning. 131 | 132 | 133 | Section 2 -- Scope. 134 | 135 | a. License grant. 136 | 137 | 1. Subject to the terms and conditions of this Public License, 138 | the Licensor hereby grants You a worldwide, royalty-free, 139 | non-sublicensable, non-exclusive, irrevocable license to 140 | exercise the Licensed Rights in the Licensed Material to: 141 | 142 | a. reproduce and Share the Licensed Material, in whole or 143 | in part; and 144 | 145 | b. produce, reproduce, and Share Adapted Material. 146 | 147 | 2. Exceptions and Limitations. For the avoidance of doubt, where 148 | Exceptions and Limitations apply to Your use, this Public 149 | License does not apply, and You do not need to comply with 150 | its terms and conditions. 151 | 152 | 3. Term. The term of this Public License is specified in Section 153 | 6(a). 154 | 155 | 4. Media and formats; technical modifications allowed. The 156 | Licensor authorizes You to exercise the Licensed Rights in 157 | all media and formats whether now known or hereafter created, 158 | and to make technical modifications necessary to do so. The 159 | Licensor waives and/or agrees not to assert any right or 160 | authority to forbid You from making technical modifications 161 | necessary to exercise the Licensed Rights, including 162 | technical modifications necessary to circumvent Effective 163 | Technological Measures. For purposes of this Public License, 164 | simply making modifications authorized by this Section 2(a) 165 | (4) never produces Adapted Material. 166 | 167 | 5. Downstream recipients. 168 | 169 | a. Offer from the Licensor -- Licensed Material. Every 170 | recipient of the Licensed Material automatically 171 | receives an offer from the Licensor to exercise the 172 | Licensed Rights under the terms and conditions of this 173 | Public License. 174 | 175 | b. No downstream restrictions. You may not offer or impose 176 | any additional or different terms or conditions on, or 177 | apply any Effective Technological Measures to, the 178 | Licensed Material if doing so restricts exercise of the 179 | Licensed Rights by any recipient of the Licensed 180 | Material. 181 | 182 | 6. No endorsement. Nothing in this Public License constitutes or 183 | may be construed as permission to assert or imply that You 184 | are, or that Your use of the Licensed Material is, connected 185 | with, or sponsored, endorsed, or granted official status by, 186 | the Licensor or others designated to receive attribution as 187 | provided in Section 3(a)(1)(A)(i). 188 | 189 | b. Other rights. 190 | 191 | 1. Moral rights, such as the right of integrity, are not 192 | licensed under this Public License, nor are publicity, 193 | privacy, and/or other similar personality rights; however, to 194 | the extent possible, the Licensor waives and/or agrees not to 195 | assert any such rights held by the Licensor to the limited 196 | extent necessary to allow You to exercise the Licensed 197 | Rights, but not otherwise. 198 | 199 | 2. Patent and trademark rights are not licensed under this 200 | Public License. 201 | 202 | 3. To the extent possible, the Licensor waives any right to 203 | collect royalties from You for the exercise of the Licensed 204 | Rights, whether directly or through a collecting society 205 | under any voluntary or waivable statutory or compulsory 206 | licensing scheme. In all other cases the Licensor expressly 207 | reserves any right to collect such royalties. 208 | 209 | 210 | Section 3 -- License Conditions. 211 | 212 | Your exercise of the Licensed Rights is expressly made subject to the 213 | following conditions. 214 | 215 | a. Attribution. 216 | 217 | 1. If You Share the Licensed Material (including in modified 218 | form), You must: 219 | 220 | a. retain the following if it is supplied by the Licensor 221 | with the Licensed Material: 222 | 223 | i. identification of the creator(s) of the Licensed 224 | Material and any others designated to receive 225 | attribution, in any reasonable manner requested by 226 | the Licensor (including by pseudonym if 227 | designated); 228 | 229 | ii. a copyright notice; 230 | 231 | iii. a notice that refers to this Public License; 232 | 233 | iv. a notice that refers to the disclaimer of 234 | warranties; 235 | 236 | v. a URI or hyperlink to the Licensed Material to the 237 | extent reasonably practicable; 238 | 239 | b. indicate if You modified the Licensed Material and 240 | retain an indication of any previous modifications; and 241 | 242 | c. indicate the Licensed Material is licensed under this 243 | Public License, and include the text of, or the URI or 244 | hyperlink to, this Public License. 245 | 246 | 2. You may satisfy the conditions in Section 3(a)(1) in any 247 | reasonable manner based on the medium, means, and context in 248 | which You Share the Licensed Material. For example, it may be 249 | reasonable to satisfy the conditions by providing a URI or 250 | hyperlink to a resource that includes the required 251 | information. 252 | 253 | 3. If requested by the Licensor, You must remove any of the 254 | information required by Section 3(a)(1)(A) to the extent 255 | reasonably practicable. 256 | 257 | 4. If You Share Adapted Material You produce, the Adapter's 258 | License You apply must not prevent recipients of the Adapted 259 | Material from complying with this Public License. 260 | 261 | 262 | Section 4 -- Sui Generis Database Rights. 263 | 264 | Where the Licensed Rights include Sui Generis Database Rights that 265 | apply to Your use of the Licensed Material: 266 | 267 | a. for the avoidance of doubt, Section 2(a)(1) grants You the right 268 | to extract, reuse, reproduce, and Share all or a substantial 269 | portion of the contents of the database; 270 | 271 | b. if You include all or a substantial portion of the database 272 | contents in a database in which You have Sui Generis Database 273 | Rights, then the database in which You have Sui Generis Database 274 | Rights (but not its individual contents) is Adapted Material; and 275 | 276 | c. You must comply with the conditions in Section 3(a) if You Share 277 | all or a substantial portion of the contents of the database. 278 | 279 | For the avoidance of doubt, this Section 4 supplements and does not 280 | replace Your obligations under this Public License where the Licensed 281 | Rights include other Copyright and Similar Rights. 282 | 283 | 284 | Section 5 -- Disclaimer of Warranties and Limitation of Liability. 285 | 286 | a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE 287 | EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS 288 | AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF 289 | ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS, 290 | IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION, 291 | WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR 292 | PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS, 293 | ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT 294 | KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT 295 | ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU. 296 | 297 | b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE 298 | TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION, 299 | NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT, 300 | INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES, 301 | COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR 302 | USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN 303 | ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR 304 | DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR 305 | IN PART, THIS LIMITATION MAY NOT APPLY TO YOU. 306 | 307 | c. The disclaimer of warranties and limitation of liability provided 308 | above shall be interpreted in a manner that, to the extent 309 | possible, most closely approximates an absolute disclaimer and 310 | waiver of all liability. 311 | 312 | 313 | Section 6 -- Term and Termination. 314 | 315 | a. This Public License applies for the term of the Copyright and 316 | Similar Rights licensed here. However, if You fail to comply with 317 | this Public License, then Your rights under this Public License 318 | terminate automatically. 319 | 320 | b. Where Your right to use the Licensed Material has terminated under 321 | Section 6(a), it reinstates: 322 | 323 | 1. automatically as of the date the violation is cured, provided 324 | it is cured within 30 days of Your discovery of the 325 | violation; or 326 | 327 | 2. upon express reinstatement by the Licensor. 328 | 329 | For the avoidance of doubt, this Section 6(b) does not affect any 330 | right the Licensor may have to seek remedies for Your violations 331 | of this Public License. 332 | 333 | c. For the avoidance of doubt, the Licensor may also offer the 334 | Licensed Material under separate terms or conditions or stop 335 | distributing the Licensed Material at any time; however, doing so 336 | will not terminate this Public License. 337 | 338 | d. Sections 1, 5, 6, 7, and 8 survive termination of this Public 339 | License. 340 | 341 | 342 | Section 7 -- Other Terms and Conditions. 343 | 344 | a. The Licensor shall not be bound by any additional or different 345 | terms or conditions communicated by You unless expressly agreed. 346 | 347 | b. Any arrangements, understandings, or agreements regarding the 348 | Licensed Material not stated herein are separate from and 349 | independent of the terms and conditions of this Public License. 350 | 351 | 352 | Section 8 -- Interpretation. 353 | 354 | a. For the avoidance of doubt, this Public License does not, and 355 | shall not be interpreted to, reduce, limit, restrict, or impose 356 | conditions on any use of the Licensed Material that could lawfully 357 | be made without permission under this Public License. 358 | 359 | b. To the extent possible, if any provision of this Public License is 360 | deemed unenforceable, it shall be automatically reformed to the 361 | minimum extent necessary to make it enforceable. If the provision 362 | cannot be reformed, it shall be severed from this Public License 363 | without affecting the enforceability of the remaining terms and 364 | conditions. 365 | 366 | c. No term or condition of this Public License will be waived and no 367 | failure to comply consented to unless expressly agreed to by the 368 | Licensor. 369 | 370 | d. Nothing in this Public License constitutes or may be interpreted 371 | as a limitation upon, or waiver of, any privileges and immunities 372 | that apply to the Licensor or You, including from the legal 373 | processes of any jurisdiction or authority. 374 | 375 | 376 | ======================================================================= 377 | 378 | Creative Commons is not a party to its public licenses. 379 | Notwithstanding, Creative Commons may elect to apply one of its public 380 | licenses to material it publishes and in those instances will be 381 | considered the "Licensor." Except for the limited purpose of indicating 382 | that material is shared under a Creative Commons public license or as 383 | otherwise permitted by the Creative Commons policies published at 384 | creativecommons.org/policies, Creative Commons does not authorize the 385 | use of the trademark "Creative Commons" or any other trademark or logo 386 | of Creative Commons without its prior written consent including, 387 | without limitation, in connection with any unauthorized modifications 388 | to any of its public licenses or any other arrangements, 389 | understandings, or agreements concerning use of licensed material. For 390 | the avoidance of doubt, this paragraph does not form part of the public 391 | licenses. 392 | 393 | Creative Commons may be contacted at creativecommons.org. 394 | -------------------------------------------------------------------------------- /web/icons/material-icons/MaterialIcons-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Coyamo/EPMW/332304b32b2975769e5fea770f7644c5dd2d9dbd/web/icons/material-icons/MaterialIcons-Regular.woff -------------------------------------------------------------------------------- /web/icons/material-icons/MaterialIcons-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Coyamo/EPMW/332304b32b2975769e5fea770f7644c5dd2d9dbd/web/icons/material-icons/MaterialIcons-Regular.woff2 -------------------------------------------------------------------------------- /web/images/default.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Coyamo/EPMW/332304b32b2975769e5fea770f7644c5dd2d9dbd/web/images/default.jpg -------------------------------------------------------------------------------- /web/img/admin_login_bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Coyamo/EPMW/332304b32b2975769e5fea770f7644c5dd2d9dbd/web/img/admin_login_bg.jpg -------------------------------------------------------------------------------- /web/img/user_login_bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Coyamo/EPMW/332304b32b2975769e5fea770f7644c5dd2d9dbd/web/img/user_login_bg.jpg -------------------------------------------------------------------------------- /web/listMyOrders.jsp: -------------------------------------------------------------------------------- 1 | <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> 2 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 3 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> 4 | 5 | 6 | 我的订单 7 | 12 | 13 | 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 | 60 | 62 | 73 | 74 | 75 | 76 | 77 | 78 |
订单编号下单时间订单金额收货人订单状态查看订单详情操作
${item.id}${item.time}${item.price}${item.name} 55 |
56 | 57 | ${array[item.state] } 58 |
59 |
查看 63 | 64 | 付款 66 | 67 | 68 | 签收 70 | 71 | 72 |
79 |
80 |
81 | 82 | 83 | -------------------------------------------------------------------------------- /web/login.jsp: -------------------------------------------------------------------------------- 1 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 2 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> 3 | 4 | 5 | 用户登录 6 | 17 | 18 | 23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 |
31 |
32 |
33 |
34 |
伊品美味
35 |
登录
36 |
37 |
38 |
39 | 40 | 41 | 48 | 49 | 50 | 51 | 58 | 59 | 60 | 61 | 67 | 68 | 69 | 74 | 75 |
42 |
43 | 44 | 46 |
47 |
52 |
53 | 54 | 56 |
57 |
62 |
63 | 64 | 65 |
66 |
71 | 73 |
76 |
77 | 79 | 注册 80 |
81 |
82 | 83 |
84 |
85 |
86 | 87 | 88 | -------------------------------------------------------------------------------- /web/main.jsp: -------------------------------------------------------------------------------- 1 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 2 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> 3 | 4 | 5 | 26 | 27 | 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 | 上一页 64 | 65 | 66 | ${requestScope.page.currentPageNum}/${requestScope.page.allPageNum}页 68 | 69 | 70 | 下一页 72 | 73 | 74 | 下一页 76 | 77 | 78 | 79 | 80 | 81 | 最后一页 82 | 83 | 84 | 最后一页 86 | 87 | 88 | 89 | 90 |
91 |
92 |
93 | 94 | 95 |
96 |
97 |
98 | 99 |
100 |
101 |
${goods.name}
102 |
${goods.description}
104 |
105 | 107 | ${goods.price}元 108 |
109 | 110 | 113 | 114 | 115 |
116 |
117 |
118 |
119 |
120 | 121 |
122 | 123 | 124 | 125 | -------------------------------------------------------------------------------- /web/modify.jsp: -------------------------------------------------------------------------------- 1 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 2 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> 3 | 4 | 5 | 修改个人资料 6 | 7 | 8 | 9 |
10 |
11 |

修改个人资料

12 |
13 |
14 |
15 |
16 |
17 |
18 | 19 | 21 |
22 |
23 | 24 | 25 |
26 |
27 | 28 | 29 |
30 |
31 | 32 | 34 |
35 |
36 | 37 | 39 |
40 |
41 | 42 | 44 |
45 |
46 |
47 | 48 | 返回主界面 49 |
50 |
51 | 52 | 57 | 58 |
59 | 60 | 61 | -------------------------------------------------------------------------------- /web/modifyAdmin.jsp: -------------------------------------------------------------------------------- 1 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 2 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> 3 | 4 | 5 | 修改密码 6 | 7 | 8 | 9 |
10 |
11 |

修改密码

12 |
13 |
14 |
15 |
16 | 17 |
18 |
19 | 20 | 22 |
23 |
24 | 25 | 26 |
27 |
28 | 29 | 30 |
31 |
32 | 33 |
34 |
35 |
36 | 37 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /web/modifyGoods.jsp: -------------------------------------------------------------------------------- 1 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 2 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> 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 | ${errMsg} 61 |
62 |
63 | 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /web/orderDetail.jsp: -------------------------------------------------------------------------------- 1 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 2 | <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> 3 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> 4 | 5 | 6 | 订单详情 7 | 8 | 9 | 10 |
11 |
12 |

订单详情

13 |
14 |
15 | ${errMsg} 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 | 48 | 49 | 50 | 51 |
订单编号:下单时间订单金额收货人收货地址联系电话订单状态
${requestScope.order.id}${requestScope.order.time}${requestScope.order.price}${requestScope.order.name}${requestScope.order.address}${requestScope.order.phone} 43 |
44 | 45 | ${array[requestScope.order.state] } 46 |
47 |
52 |
53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 |
序号菜品名称菜品价格数量小计
${item.goods.id}${item.goods.name}${item.goods.price}${item.count}${item.price}
76 |
77 |
78 | 93 |
94 |
95 |
96 | 97 | 0 98 |
99 |
100 | 103 | 104 |
105 | 106 | 107 | -------------------------------------------------------------------------------- /web/orderDetailAdmin.jsp: -------------------------------------------------------------------------------- 1 | <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> 2 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 3 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> 4 | 5 | 6 | 订单详情 7 | 8 | 9 | 10 |
11 |
12 |

订单详情

13 |
14 |
15 | ${errMsg} 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 | 48 | 49 | 50 |
订单编号:下单时间订单金额收货人收货地址联系电话订单状态
${requestScope.order.id}${requestScope.order.time}${requestScope.order.price}${requestScope.order.name}${requestScope.order.address}${requestScope.order.phone} 43 |
44 | 45 | ${array[requestScope.order.state] } 46 |
47 |
51 |
52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 |
序号菜品名称菜品价格数量小计
${item.goods.id}${item.goods.name}${item.goods.price}${item.count}${item.price}
74 |
75 | 90 |
91 |
92 |
93 | 94 | 0 95 |
96 |
97 | 100 | 101 | 102 |
103 | 104 | 105 | -------------------------------------------------------------------------------- /web/orderManagerAdmin.jsp: -------------------------------------------------------------------------------- 1 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 2 | <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> 3 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> 4 | 5 | 6 | 订单管理 7 | 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 | ${requestScope.page.currentPageNum}/${requestScope.page.allPageNum}页 60 | 61 | 62 | 下一页 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 | 116 | 120 | 126 | 127 | 128 | 129 | 130 |
订单编号下单时间订单金额收货人订单状态查看订单详情操作
${item.id}${item.time}${item.price}${item.name} 111 |
112 | 113 | ${array[item.state] } 114 |
115 |
117 | 查看 119 | 121 | 122 | 派送 124 | 125 |
131 |
132 |
133 | 134 | 135 | -------------------------------------------------------------------------------- /web/register.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html;charset=UTF-8" %> 2 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 3 | 4 | 5 | 新用户注册 6 | 28 | 29 | 30 | 31 | 47 | 48 |
49 |
50 |
51 |
52 |
伊品美味
53 |
新用户注册
54 |
55 |
56 |
57 |
58 |
59 | 60 | 62 |
63 | 64 |
65 | 66 | 68 |
69 | 70 |
71 | 72 | 74 |
75 | 76 |
77 | 78 | 80 |
81 | 82 |
83 | 84 | 86 |
87 | 88 |
89 | 90 | 92 |
93 | 94 |
95 | 96 | 97 |
98 | 99 | 无法加载验证码 101 | 103 |
104 |
105 | 107 | 108 | 返回 109 |
110 |
111 |
112 |
113 |
114 | 115 | 116 | 117 | 124 |

注册成功!登录


125 |
126 | 127 | 128 | 129 | 130 | 135 | 136 | 137 | 138 | -------------------------------------------------------------------------------- /web/showCart.jsp: -------------------------------------------------------------------------------- 1 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 2 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> 3 | 4 | 5 | 我的购物车 6 | 7 | 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 | 86 | 87 | 90 | 91 | 92 | 93 | 94 |
序号菜品名称菜品价格数量小计删除
${status.index+1}${item.goods.name}${item.goods.price} 82 | 84 | ${item.price}删除
95 |
96 |
97 |
98 | 99 | 合计:0 100 |
101 |
102 | 继续购物    103 |   104 | 去结算 105 |
106 | 107 |
108 | 109 | 110 | --------------------------------------------------------------------------------