├── README.md ├── lokismbms.sql ├── pom.xml └── src └── main ├── java └── smbms │ ├── dao │ ├── BaseDao.java │ ├── goods │ │ ├── GoodsDao.java │ │ ├── GoodsDao.xml │ │ └── GoodsDaoImpl.java │ └── user │ │ ├── UserDao.java │ │ ├── UserDao.xml │ │ └── UserDaoImpl.java │ ├── filter │ ├── CharacterEncoding.java │ └── SysFilter.java │ ├── pojo │ ├── Good_List.java │ ├── Goods.java │ └── User.java │ ├── services │ ├── goods │ │ ├── GoodsServices.java │ │ └── GoodsServicesImpl.java │ └── user │ │ ├── UserServices.java │ │ └── UserServicesImpl.java │ ├── servlet │ ├── CartShowServlet.java │ ├── GoodsInfoServlet.java │ ├── GoodsShowServlet.java │ ├── InsertGoodsServlet.java │ ├── ListedGoodsServlet.java │ ├── LoginServlet.java │ ├── LogoutServlet.java │ ├── SecListedServlet.java │ └── UserShowServlet.java │ └── tools │ └── Constants.java ├── resources └── db.properties └── webapp ├── WEB-INF └── web.xml ├── css ├── cube.css ├── public.css └── style.css ├── error.jsp ├── images ├── buy.png ├── clock.jpg ├── formBg.png ├── gys.png ├── home.png ├── leftBg.png ├── loginBg.jpg ├── login_bg.jpg ├── login_img.png ├── mm.png ├── n.png ├── read.png ├── schu.png ├── search.png ├── tc.png ├── tianjia.png ├── time.png ├── xiugai.png ├── y.png ├── yh.png └── zd.png ├── jsp ├── buygoods.jsp ├── common │ ├── foot.jsp │ └── head.jsp ├── error.jsp ├── frame.jsp ├── goodsshow.jsp ├── pwdmodify.jsp ├── shoppingcart.jsp └── usershow.jsp ├── login.jsp └── register.jsp /README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | # 基于MVC+Maven+JDBC+JSP+Servlet实现的JavaWeb项目 6 | 7 | 一个用户一个购物车,有登录功能但是没截图 8 | ## 1、界面展示 9 | 10 | ![image-20210604203951211](https://i.loli.net/2021/06/08/SfTF2CtjMueZp9o.png) 11 | ![image-20210604204016216](https://i.loli.net/2021/06/08/5BikSqwl9vpaCUJ.png) 12 | 13 | ![image-20210604204201608](https://i.loli.net/2021/06/08/FJcQenrNgGO75bP.png) 14 | 15 | ![image-20210604204221254](https://i.loli.net/2021/06/08/vpu4Fx6GBe28X1h.png) 16 | 17 | 18 | 19 | ## 2、如何在你的电脑上运行这个项目 20 | 21 | 22 | ** 23 | 需要的环境 24 | jdk8 + maven + mysql 8.0.23 25 | ** 26 | 1. 下载完成后再idea导入这个包 27 | 28 | ![image-20210608140645442](https://i.loli.net/2021/06/08/szZ8ug5BQC13nk2.png) 29 | 30 | 2. 将resource目录marked as resourceRepositories 31 | 32 | ![image-20210608141150330](https://i.loli.net/2021/06/08/XbVThcnNaD3SUgY.png) 33 | 34 | 3. 创建一个MySQL数据库,创建表的sql语句在同级目录中 35 | 36 | 4. 修改db.properties中的用户名和密码和使用的数据库 37 | 38 | ```properties 39 | #数据库配置文件,然后在Basedao读取这个文件 40 | driver=com.mysql.jdbc.Driver 41 | url=jdbc:mysql://localhost:3306/使用的数据库 42 | username=MySQL账号 43 | password=MySQL登录密码 44 | ``` 45 | 46 | 47 | -------------------------------------------------------------------------------- /lokismbms.sql: -------------------------------------------------------------------------------- 1 | /* 2 | Navicat Premium Data Transfer 3 | 4 | Source Server : loki 5 | Source Server Type : MySQL 6 | Source Server Version : 80023 7 | Source Host : localhost:3306 8 | Source Schema : lokismbms 9 | 10 | Target Server Type : MySQL 11 | Target Server Version : 80023 12 | File Encoding : 65001 13 | 14 | Date: 09/06/2021 00:46:23 15 | */ 16 | 17 | SET NAMES utf8mb4; 18 | SET FOREIGN_KEY_CHECKS = 0; 19 | 20 | -- ---------------------------- 21 | -- Table structure for cart 22 | -- ---------------------------- 23 | DROP TABLE IF EXISTS `cart`; 24 | CREATE TABLE `cart` ( 25 | `Uid` int NOT NULL, 26 | `Gid` int NULL DEFAULT NULL 27 | ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; 28 | 29 | -- ---------------------------- 30 | -- Records of cart 31 | -- ---------------------------- 32 | INSERT INTO `cart` VALUES (1, 2); 33 | INSERT INTO `cart` VALUES (1, 15); 34 | INSERT INTO `cart` VALUES (3, 1); 35 | INSERT INTO `cart` VALUES (3, 2); 36 | INSERT INTO `cart` VALUES (3, 15); 37 | 38 | -- ---------------------------- 39 | -- Table structure for goods 40 | -- ---------------------------- 41 | DROP TABLE IF EXISTS `goods`; 42 | CREATE TABLE `goods` ( 43 | `Gid` int NOT NULL, 44 | `Gprice` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, 45 | `Gname` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, 46 | `Gurl` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, 47 | `Glist_id` int NOT NULL, 48 | `Gdesc` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, 49 | PRIMARY KEY (`Gid`) USING BTREE 50 | ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; 51 | 52 | -- ---------------------------- 53 | -- Records of goods 54 | -- ---------------------------- 55 | INSERT INTO `goods` VALUES (1, '399.9', '迪卡侬7号篮球 ', 'http://pngimg.com/uploads/basketball/basketball_PNG1094.png', 1, '这款标准尺寸的7号球适合室内外使用,适用于13岁及以上男性.\r\n\r\n这款7号篮球适用于男孩和成人男性. 聚氨酯外壳,手感良好.FIBA认证版本有售.'); 56 | INSERT INTO `goods` VALUES (2, '39', 'Butterfly乒乓球', 'https://img14.360buyimg.com/n1/s546x546_jfs/t1/122208/5/12831/75677/5f631887Ea0a497a1/dc25f8a3a1926d45.jpg', 1, '正中品质乒乓球三星级比赛训练用球多球40+新料白色黄色ppq高弹耐打 萨达乒乓球-10个装-白色'); 57 | INSERT INTO `goods` VALUES (3, '749', 'adidas跑鞋', 'https://img.adidas.com.hk/resources/2021/4/28/1619610167842682_500X500.JPG', 2, '还没来得及写呢'); 58 | INSERT INTO `goods` VALUES (4, '499', '卡西欧运动手表', 'http://pngimg.com/uploads/watches/watches_PNG101453.png', 5, '还没来得及写呢'); 59 | INSERT INTO `goods` VALUES (5, '49', '李宁运动短袖', 'https://img14.360buyimg.com/n0/jfs/t1/21438/11/12424/107478/5c987840E1789c24b/33c28351c54543a6.jpg', 2, '还没来得及写呢'); 60 | INSERT INTO `goods` VALUES (6, '129', 'arena泳镜', 'https://img14.360buyimg.com/n0/jfs/t1/94692/21/12504/335890/5e494129Efd4d8649/704f3c1a233f7dda.jpg', 3, '还没来得及写呢'); 61 | INSERT INTO `goods` VALUES (7, '78', '李宁泳裤', 'https://img14.360buyimg.com/n0/jfs/t1/66805/9/5492/344674/5d397b5cE758d2c79/70ed518365db20f7.jpg', 3, '还没来得及写呢'); 62 | INSERT INTO `goods` VALUES (8, '1999', '华为智选跑步机', 'https://img14.360buyimg.com/n1/s546x546_jfs/t1/192752/28/4264/172244/60a68940Ea577c4e5/f7d20f19f8c32132.jpg', 2, '还没来得及写呢'); 63 | INSERT INTO `goods` VALUES (9, ' 3298', 'GoPro9', 'http://pngimg.com/uploads/gopro/gopro_PNG102046.png', 5, '还没来得及写呢'); 64 | INSERT INTO `goods` VALUES (10, '3499', 'DJI Pocket2', 'https://img14.360buyimg.com/n1/s546x546_jfs/t1/125577/6/18823/28999/5fb5f781E8461a8a8/d14ece3d93ec7e8b.jpg', 5, '还没来得及写呢'); 65 | INSERT INTO `goods` VALUES (11, '449', '锐步(Reebok)哑铃', 'https://img14.360buyimg.com/n1/s546x546_jfs/t1/115236/8/11103/149334/5ef95a3bE4d9d7c1d/be22564d431c635a.jpg', 4, '还没来得及写呢'); 66 | INSERT INTO `goods` VALUES (12, '158', '军哥7号篮球', 'https://img14.360buyimg.com/n0/jfs/t1/161210/36/1443/173789/5ff665f1E40fca477/e4d6196475dadfcd.jpg', 1, '室内室外篮球通用七号成人比赛训练篮球礼物 绿精灵白沟'); 67 | INSERT INTO `goods` VALUES (13, '268', 'CUPPa 斯诺克比赛用球', 'https://img14.360buyimg.com/n0/jfs/t9322/199/652518550/404452/4f9b1032/59acb179N2328ddde.jpg', 1, '比赛专用斯诺克球子 桌球水晶台球用品'); 68 | INSERT INTO `goods` VALUES (14, '14900', 'Kevin Deroo S1', 'https://img14.360buyimg.com/n0/jfs/t1/5811/14/621/74349/5b921efcEa673c3a1/2e40bc27af930cbf.jpg', 1, '加拿大迪鹿斯诺克Kevin Deroo S1全黑檀枫木斯诺克台球杆通小头水晶漆路'); 69 | INSERT INTO `goods` VALUES (15, '199', '世达(star)足球', 'https://img14.360buyimg.com/n0/jfs/t1/145853/24/13170/159236/5fa217c2Ecaebca83/7cbbe16afc666200.jpg', 1, '世达(star)SB375F 成人手缝训练足球足球 PU手缝足球 竞技用球 ( FIFA认证 ) 5号球'); 70 | INSERT INTO `goods` VALUES (16, '299', 'FIFA认证足球', 'https://img14.360buyimg.com/n0/jfs/t1/64227/25/9506/225027/5d721dd8E90ae49ca/19398d7b54e70b80.jpg', 1, 'Train火车头 FIFA认证足球 PU折边胶粘 标准5号比赛足球 火车FKS532'); 71 | 72 | -- ---------------------------- 73 | -- Table structure for goods_list 74 | -- ---------------------------- 75 | DROP TABLE IF EXISTS `goods_list`; 76 | CREATE TABLE `goods_list` ( 77 | `Lid` int NOT NULL, 78 | `Lname` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, 79 | PRIMARY KEY (`Lid`) USING BTREE 80 | ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; 81 | 82 | -- ---------------------------- 83 | -- Records of goods_list 84 | -- ---------------------------- 85 | INSERT INTO `goods_list` VALUES (1, '球类用品'); 86 | INSERT INTO `goods_list` VALUES (2, '跑步用品'); 87 | INSERT INTO `goods_list` VALUES (3, '游泳用品'); 88 | INSERT INTO `goods_list` VALUES (4, '健身用品'); 89 | INSERT INTO `goods_list` VALUES (5, '电子数码'); 90 | 91 | -- ---------------------------- 92 | -- Table structure for user 93 | -- ---------------------------- 94 | DROP TABLE IF EXISTS `user`; 95 | CREATE TABLE `user` ( 96 | `Uid` int NOT NULL, 97 | `username` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, 98 | `pwd` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, 99 | `Uname` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, 100 | PRIMARY KEY (`Uid`) USING BTREE 101 | ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; 102 | 103 | -- ---------------------------- 104 | -- Records of user 105 | -- ---------------------------- 106 | INSERT INTO `user` VALUES (1, 'admin', '123456', '系统管理员'); 107 | INSERT INTO `user` VALUES (2, 'wangzhe', '123456', '王哲'); 108 | INSERT INTO `user` VALUES (3, '1', '1', '测试'); 109 | 110 | SET FOREIGN_KEY_CHECKS = 1; 111 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 4.0.0 6 | 7 | org.example 8 | sportsStore 9 | 1.0-SNAPSHOT 10 | war 11 | 12 | 13 | 14 | 15 | javax.servlet 16 | javax.servlet-api 17 | 4.0.1 18 | 19 | 20 | 21 | javax.servlet.jsp 22 | jsp-api 23 | 2.1 24 | 25 | 26 | 27 | mysql 28 | mysql-connector-java 29 | 8.0.23 30 | 31 | 32 | 33 | javax.servlet.jsp.jstl 34 | jstl-api 35 | 1.2 36 | 37 | 38 | 39 | taglibs 40 | standard 41 | 1.1.2 42 | 43 | 44 | 45 | org.mybatis 46 | mybatis 47 | 3.5.7 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | src/main/java 57 | 58 | **/*.properties 59 | **/*.xml 60 | 61 | false 62 | 63 | 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /src/main/java/smbms/dao/BaseDao.java: -------------------------------------------------------------------------------- 1 | package smbms.dao; 2 | 3 | import java.io.IOException; 4 | import java.io.InputStream; 5 | import java.sql.*; 6 | import java.util.Collection; 7 | import java.util.Properties; 8 | 9 | /** 10 | * 操作数据库的基本类 11 | */ 12 | public class BaseDao { 13 | static { 14 | init(); 15 | } 16 | 17 | private static String driver; 18 | private static String url; 19 | private static String user; 20 | private static String password; 21 | 22 | /** 23 | * 读取配置文件对数据库初始化,使用静态代码块在类加载前调用 24 | */ 25 | public static void init() { 26 | InputStream resourceAsStream = BaseDao.class.getClassLoader().getResourceAsStream("db.properties"); 27 | Properties properties = new Properties(); 28 | 29 | try { 30 | properties.load(resourceAsStream); 31 | } catch (IOException e) { 32 | e.printStackTrace(); 33 | } 34 | driver = properties.getProperty("driver"); 35 | url = properties.getProperty("url"); 36 | user = properties.getProperty("user"); 37 | password = properties.getProperty("password"); 38 | } 39 | 40 | /** 41 | * 此方法获得一个connection连接 42 | * 43 | * @return 44 | */ 45 | public static Connection getConnection() { 46 | //加载驱动 47 | try { 48 | Class.forName(driver); 49 | } catch (ClassNotFoundException e) { 50 | e.printStackTrace(); 51 | } 52 | //获取连接 53 | Connection connection = null; 54 | try { 55 | connection = DriverManager.getConnection(url, user, password); 56 | } catch (SQLException throwables) { 57 | throwables.printStackTrace(); 58 | } 59 | return connection; 60 | } 61 | 62 | /** 63 | * 查询操作 64 | * 获取service层统一的connection对象,补充预编译sql语句,返回结果集 65 | * @param connection 66 | * @param pstm 67 | * @param resultSet 68 | * @param sql 69 | * @param params 70 | * @return 71 | * @throws Exception 72 | */ 73 | public static ResultSet execute(Connection connection, PreparedStatement pstm,ResultSet resultSet, String sql, Object[] params) throws Exception { 74 | //预编译SQL语句,返回一个PreparedStatement实例 75 | pstm = connection.prepareStatement(sql); 76 | for (int i = 0; i < params.length; i++) { 77 | pstm.setObject(i+1,params[i]); 78 | } 79 | resultSet = pstm.executeQuery(); 80 | return resultSet; 81 | } 82 | 83 | /** 84 | * 更新操作,返回受影响的行数 85 | * @param connection 86 | * @param pstm 87 | * @param sql 88 | * @param params 89 | * @return 90 | * @throws Exception 91 | */ 92 | public static int executeUpdate(Connection connection, PreparedStatement pstm, 93 | String sql, Object[] params) throws Exception { 94 | int updateRows = 0; 95 | pstm = connection.prepareStatement(sql); 96 | for (int i = 0; i < params.length; i++) { 97 | pstm.setObject(i + 1, params[i]); 98 | } 99 | updateRows = pstm.executeUpdate(); 100 | return updateRows; 101 | } 102 | 103 | /** 104 | * 105 | * @param connection 106 | * @param pstm 107 | * @param rs 108 | * @return 109 | */ 110 | public static boolean closeResource(Connection connection,PreparedStatement pstm,ResultSet rs){ 111 | boolean flag = true; 112 | if(rs != null){ 113 | try { 114 | rs.close(); 115 | rs = null;//GC回收 116 | } catch (SQLException e) { 117 | // TODO Auto-generated catch block 118 | e.printStackTrace(); 119 | flag = false; 120 | } 121 | } 122 | if(pstm != null){ 123 | try { 124 | pstm.close(); 125 | pstm = null;//GC回收 126 | } catch (SQLException e) { 127 | // TODO Auto-generated catch block 128 | e.printStackTrace(); 129 | flag = false; 130 | } 131 | } 132 | if(connection != null){ 133 | try { 134 | connection.close(); 135 | connection = null;//GC回收 136 | } catch (SQLException e) { 137 | // TODO Auto-generated catch block 138 | e.printStackTrace(); 139 | flag = false; 140 | } 141 | } 142 | 143 | return flag; 144 | 145 | } 146 | } 147 | -------------------------------------------------------------------------------- /src/main/java/smbms/dao/goods/GoodsDao.java: -------------------------------------------------------------------------------- 1 | package smbms.dao.goods; 2 | 3 | import smbms.pojo.Good_List; 4 | import smbms.pojo.Goods; 5 | 6 | import java.sql.Connection; 7 | import java.util.List; 8 | 9 | public interface GoodsDao { 10 | 11 | /** 12 | * @return 全部商品 13 | */ 14 | public List getAllGoods(Connection connection) throws Exception; 15 | 16 | /** 17 | * 传入Glist_id 18 | * 19 | * @return 根据商品分类id返回特定商品 20 | */ 21 | public List getGoods(Connection connection, int listId) throws Exception; 22 | 23 | /** 24 | * @param connection 25 | * @param name 26 | * @return 返回一个商品列表 27 | * @throws Exception 28 | */ 29 | public List getGoodsByName(Connection connection,String name) throws Exception; 30 | 31 | /** 32 | * 通过gid获取该商品 33 | * @param Gid 34 | * @param connection 35 | * @return 36 | * @throws Exception 37 | */ 38 | public Goods getGoodsBygid(Connection connection, int Gid) throws Exception; 39 | 40 | /** 41 | * 向购物车表中传入Gid和ListID属性 42 | * @param connection 43 | * @param gid 44 | * @param uid 45 | * @return 46 | * @throws Exception 47 | */ 48 | public int insertGoods(Connection connection, int gid, int uid) throws Exception; 49 | 50 | public List getCartGoods(Connection connection, int uid) throws Exception; 51 | 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/smbms/dao/goods/GoodsDao.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/main/java/smbms/dao/goods/GoodsDaoImpl.java: -------------------------------------------------------------------------------- 1 | package smbms.dao.goods; 2 | 3 | import smbms.dao.BaseDao; 4 | import smbms.pojo.Goods; 5 | 6 | import java.sql.Connection; 7 | import java.sql.PreparedStatement; 8 | import java.sql.ResultSet; 9 | import java.util.ArrayList; 10 | import java.util.List; 11 | 12 | public class GoodsDaoImpl implements GoodsDao { 13 | /** 14 | * @return 15 | */ 16 | @Override 17 | public List getAllGoods(Connection connection) throws Exception { 18 | List goodsList = new ArrayList<>(); 19 | PreparedStatement pstm = null; 20 | ResultSet rs = null; 21 | String sql = "select * from goods"; 22 | Object[] param = {}; 23 | Goods goods = null; 24 | if (null != connection) {//避免空指针异常 25 | rs = BaseDao.execute(connection, pstm, rs, sql, param); 26 | while (rs.next()) { 27 | goods = new Goods(); 28 | goods.setGid(rs.getInt("Gid")); 29 | goods.setGname(rs.getString("Gname")); 30 | goods.setGprice(rs.getString("Gprice")); 31 | goods.setGurl(rs.getString("Gurl")); 32 | goods.setGlist_id(rs.getInt("Glist_id")); 33 | goodsList.add(goods); 34 | } 35 | } 36 | return goodsList; 37 | } 38 | 39 | @Override 40 | public List getGoods(Connection connection, int listId) throws Exception { 41 | String sql = "select * from goods where Glist_id=?"; 42 | List goodsList = new ArrayList<>(); 43 | PreparedStatement pstm = null; 44 | ResultSet rs = null; 45 | Object[] param = {listId}; 46 | Goods goods = null; 47 | if (null != connection) {//避免空指针异常 48 | rs = BaseDao.execute(connection, pstm, rs, sql, param); 49 | while (rs.next()) { 50 | goods = new Goods(); 51 | goods.setGid(rs.getInt("Gid")); 52 | goods.setGname(rs.getString("Gname")); 53 | goods.setGprice(rs.getString("Gprice")); 54 | goods.setGurl(rs.getString("Gurl")); 55 | goods.setGlist_id(rs.getInt("Glist_id")); 56 | goodsList.add(goods); 57 | } 58 | } 59 | return goodsList; 60 | } 61 | 62 | @Override 63 | public List getGoodsByName(Connection connection, String name) throws Exception { 64 | List goodsList = new ArrayList<>(); 65 | //TODO:jdbc对于模糊查询like语句嵌套变量的sql语句写法 66 | String sql = "select * from goods where gdesc like ?"; 67 | PreparedStatement pstm = connection.prepareStatement(sql); 68 | //TODO:解决方案 69 | pstm.setObject(1,"%"+name+"%"); 70 | ResultSet rs = null; 71 | Goods goods = null; 72 | if (null != connection) {//避免空指针异常 73 | rs = pstm.executeQuery(); 74 | while (rs.next()) { 75 | goods = new Goods(); 76 | goods.setGid(rs.getInt("Gid")); 77 | goods.setGname(rs.getString("Gname")); 78 | goods.setGprice(rs.getString("Gprice")); 79 | goods.setGurl(rs.getString("Gurl")); 80 | goods.setGlist_id(rs.getInt("Glist_id")); 81 | goodsList.add(goods); 82 | } 83 | } 84 | return goodsList; 85 | } 86 | 87 | @Override 88 | public Goods getGoodsBygid(Connection connection, int Gid) throws Exception { 89 | String sql = "select * from goods where Gid=?"; 90 | Goods goods = new Goods(); 91 | PreparedStatement pstm = null; 92 | ResultSet rs = null; 93 | Object[] param = {Gid}; 94 | if (null != connection) { 95 | rs = BaseDao.execute(connection, pstm, rs, sql, param); 96 | if (rs.next()) { 97 | goods.setGid(rs.getInt(1)); 98 | goods.setGname(rs.getString("Gname")); 99 | goods.setGprice(rs.getString("Gprice")); 100 | goods.setGurl(rs.getString("Gurl")); 101 | goods.setGlist_id(rs.getInt("Glist_id")); 102 | goods.setGdesc(rs.getString(6)); 103 | } 104 | } 105 | return goods; 106 | } 107 | 108 | @Override 109 | public int insertGoods(Connection connection, int gid, int uid) throws Exception { 110 | int updateRows = 0; 111 | String sql = "insert into cart(Uid,Gid) values(?,?)"; 112 | PreparedStatement pstm = null; 113 | Object[] param = {uid, gid}; 114 | if (null != connection) { 115 | updateRows = BaseDao.executeUpdate(connection, pstm, sql, param); 116 | } 117 | return updateRows; 118 | } 119 | 120 | @Override 121 | public List getCartGoods(Connection connection, int uid) throws Exception { 122 | List goodsList = new ArrayList<>(); 123 | String sql = "select * from goods where gid in (SELECT gid from cart where uid=?)"; 124 | Object[] param = {uid}; 125 | PreparedStatement pstm = null; 126 | ResultSet rs = null; 127 | Goods goods = null; 128 | if (null != connection) { 129 | rs = BaseDao.execute(connection, pstm, rs, sql, param); 130 | while (rs.next()) { 131 | goods = new Goods(); 132 | goods.setGid(rs.getInt("Gid")); 133 | goods.setGname(rs.getString("Gname")); 134 | goods.setGprice(rs.getString("Gprice")); 135 | goods.setGurl(rs.getString("Gurl")); 136 | goods.setGlist_id(rs.getInt("Glist_id")); 137 | goodsList.add(goods); 138 | } 139 | } 140 | return goodsList; 141 | } 142 | 143 | 144 | } 145 | -------------------------------------------------------------------------------- /src/main/java/smbms/dao/user/UserDao.java: -------------------------------------------------------------------------------- 1 | package smbms.dao.user; 2 | 3 | import smbms.pojo.User; 4 | 5 | import java.sql.Connection; 6 | import java.util.List; 7 | 8 | 9 | /** 10 | * dao层抛出异常,让service层去捕获处理 11 | */ 12 | public interface UserDao { 13 | /** 14 | * 通过username获取User信息 15 | * @param connection 16 | * @param username 17 | * @return 18 | * @throws Exception 19 | */ 20 | public User getUser(Connection connection, String username) throws Exception; 21 | 22 | /** 23 | * 调用此方法返回用户信息列表 24 | * @param connection 25 | * @return 26 | * @throws Exception 27 | */ 28 | public List getAllUsers(Connection connection) throws Exception; 29 | 30 | 31 | 32 | 33 | 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/smbms/dao/user/UserDao.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/main/java/smbms/dao/user/UserDaoImpl.java: -------------------------------------------------------------------------------- 1 | package smbms.dao.user; 2 | 3 | import smbms.dao.BaseDao; 4 | import smbms.pojo.User; 5 | 6 | import java.sql.Connection; 7 | import java.sql.PreparedStatement; 8 | import java.sql.ResultSet; 9 | import java.util.ArrayList; 10 | import java.util.Collection; 11 | import java.util.List; 12 | 13 | public class UserDaoImpl implements UserDao { 14 | /** 15 | * 调用BaseDao中的excute方法,返回一个结果集并从中获取数据 16 | * 17 | * @param connection 18 | * @param username 19 | * @return 20 | * @throws Exception 21 | */ 22 | @Override 23 | public User getUser(Connection connection, String username) throws Exception { 24 | PreparedStatement pstm = null; 25 | ResultSet resultSet = null; 26 | User user = null; 27 | if (null != connection) { 28 | String sql = "select * from user where username=?"; 29 | Object[] params = {username}; 30 | resultSet = BaseDao.execute(connection, pstm, resultSet, sql, params); 31 | if (resultSet.next()) { 32 | user = new User(); 33 | user.setUid(resultSet.getInt("Uid")); 34 | user.setUsername(resultSet.getString("username")); 35 | user.setPwd(resultSet.getString("pwd")); 36 | user.setUname(resultSet.getString("Uname")); 37 | } 38 | BaseDao.closeResource(null, null, null); 39 | } 40 | 41 | return user; 42 | } 43 | 44 | /** 45 | * 返回一个List集合 46 | * @param connection 47 | * @return 48 | * @throws Exception 49 | */ 50 | @Override 51 | public List getAllUsers(Connection connection) throws Exception { 52 | List allUser = new ArrayList<>(); 53 | PreparedStatement preparedStatement = null; 54 | ResultSet rs =null; 55 | User user = null; 56 | if(null!= connection){ 57 | String sql = "select * from user"; 58 | Object[] param = {}; 59 | ResultSet resultSet = BaseDao.execute(connection, preparedStatement, rs, sql, param); 60 | while (resultSet.next()){ 61 | user = new User(); 62 | user.setUid(resultSet.getInt("Uid")); 63 | user.setUsername(resultSet.getString("username")); 64 | user.setPwd(resultSet.getString("pwd")); 65 | user.setUname(resultSet.getString("Uname")); 66 | allUser.add(user); 67 | } 68 | } 69 | return allUser; 70 | } 71 | 72 | 73 | } -------------------------------------------------------------------------------- /src/main/java/smbms/filter/CharacterEncoding.java: -------------------------------------------------------------------------------- 1 | package smbms.filter; 2 | 3 | import javax.servlet.*; 4 | import javax.servlet.annotation.WebFilter; 5 | import java.io.IOException; 6 | 7 | //TODO 解决乱码问题 8 | @WebFilter(filterName = "CharacterEncoding",urlPatterns = "/jsp/*") 9 | public class CharacterEncoding implements Filter { 10 | 11 | @Override 12 | public void init(FilterConfig filterConfig) throws ServletException { 13 | // TODO Auto-generated method stub 14 | 15 | } 16 | 17 | @Override 18 | public void doFilter(ServletRequest request, ServletResponse response, 19 | FilterChain chain) throws IOException, ServletException { 20 | // TODO Auto-generated method stub 21 | request.setCharacterEncoding("UTF-8"); 22 | response.setCharacterEncoding("UTF-8"); 23 | chain.doFilter(request, response); 24 | } 25 | 26 | @Override 27 | public void destroy() { 28 | // TODO Auto-generated method stub 29 | 30 | } 31 | 32 | } -------------------------------------------------------------------------------- /src/main/java/smbms/filter/SysFilter.java: -------------------------------------------------------------------------------- 1 | package smbms.filter; 2 | 3 | import smbms.pojo.User; 4 | 5 | import javax.servlet.*; 6 | import javax.servlet.annotation.WebFilter; 7 | import javax.servlet.http.HttpServletRequest; 8 | import javax.servlet.http.HttpServletResponse; 9 | import java.io.IOException; 10 | 11 | /** 12 | * 实现权限拦截,当检测到session为空时,转到错误界面 13 | */ 14 | @WebFilter(filterName = "SysFilter",urlPatterns = "/jsp/*") 15 | public class SysFilter implements Filter { 16 | public void destroy() { 17 | } 18 | 19 | public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain) throws ServletException, IOException { 20 | // System.out.println("SysFilter doFilter()==========="); 21 | HttpServletRequest rq = (HttpServletRequest)req; 22 | HttpServletResponse rp = (HttpServletResponse)resp; 23 | User userSession = (User)rq.getSession().getAttribute("userSession"); 24 | if(null == userSession){ 25 | rp.sendRedirect(rq.getContextPath()+"/error.jsp"); 26 | }else{ 27 | chain.doFilter(req, resp); 28 | } 29 | } 30 | 31 | public void init(FilterConfig config) throws ServletException { 32 | 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/smbms/pojo/Good_List.java: -------------------------------------------------------------------------------- 1 | package smbms.pojo; 2 | 3 | public class Good_List { 4 | private int Lid;//对应goods中的Glist_id 5 | private String Lname; 6 | 7 | public Good_List() { 8 | } 9 | 10 | public Good_List(int lid, String lname) { 11 | Lid = lid; 12 | Lname = lname; 13 | } 14 | 15 | public int getLid() { 16 | return Lid; 17 | } 18 | 19 | public void setLid(int lid) { 20 | Lid = lid; 21 | } 22 | 23 | public String getLname() { 24 | return Lname; 25 | } 26 | 27 | public void setLname(String lname) { 28 | Lname = lname; 29 | } 30 | 31 | @Override 32 | public String toString() { 33 | return "Good_List{" + 34 | "Lid=" + Lid + 35 | ", Lname='" + Lname + '\'' + 36 | '}'; 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/smbms/pojo/Goods.java: -------------------------------------------------------------------------------- 1 | package smbms.pojo; 2 | 3 | 4 | public class Goods { 5 | private int gid;//商品id 6 | private String gprice;//商品价格 7 | private String gname;//商品名称 8 | private String gurl;//商品url 9 | private int glist_id;//商品分类id 10 | private String gdesc; 11 | 12 | public Goods() { 13 | } 14 | 15 | public String getGdesc() { 16 | return gdesc; 17 | } 18 | 19 | public void setGdesc(String gdesc) { 20 | this.gdesc = gdesc; 21 | } 22 | 23 | @Override 24 | public String toString() { 25 | return "Goods{" + 26 | "gid=" + gid + 27 | ", gprice='" + gprice + '\'' + 28 | ", gname='" + gname + '\'' + 29 | ", gurl='" + gurl + '\'' + 30 | ", glist_id=" + glist_id + 31 | ", gdesc='" + gdesc + '\'' + 32 | '}'; 33 | } 34 | 35 | public int getGid() { 36 | return gid; 37 | } 38 | 39 | public void setGid(int gid) { 40 | this.gid = gid; 41 | } 42 | 43 | public String getGprice() { 44 | return gprice; 45 | } 46 | 47 | public void setGprice(String gprice) { 48 | this.gprice = gprice; 49 | } 50 | 51 | public String getGname() { 52 | return gname; 53 | } 54 | 55 | public void setGname(String gname) { 56 | this.gname = gname; 57 | } 58 | 59 | public String getGurl() { 60 | return gurl; 61 | } 62 | 63 | public void setGurl(String gurl) { 64 | this.gurl = gurl; 65 | } 66 | 67 | public int getGlist_id() { 68 | return glist_id; 69 | } 70 | 71 | public void setGlist_id(int glist_id) { 72 | this.glist_id = glist_id; 73 | } 74 | 75 | public Goods(int gid, String gprice, String gname, String gurl, int glist_id, String gdesc) { 76 | this.gid = gid; 77 | this.gprice = gprice; 78 | this.gname = gname; 79 | this.gurl = gurl; 80 | this.glist_id = glist_id; 81 | this.gdesc = gdesc; 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /src/main/java/smbms/pojo/User.java: -------------------------------------------------------------------------------- 1 | package smbms.pojo; 2 | 3 | public class User { 4 | private int uid; 5 | private String username; 6 | private String pwd; 7 | private String uname; 8 | 9 | public User() { 10 | } 11 | 12 | public int getUid() { 13 | return uid; 14 | } 15 | 16 | public void setUid(int uid) { 17 | this.uid = uid; 18 | } 19 | 20 | public String getUsername() { 21 | return username; 22 | } 23 | 24 | public void setUsername(String username) { 25 | this.username = username; 26 | } 27 | 28 | public String getPwd() { 29 | return pwd; 30 | } 31 | 32 | public void setPwd(String pwd) { 33 | this.pwd = pwd; 34 | } 35 | 36 | public String getUname() { 37 | return uname; 38 | } 39 | 40 | public void setUname(String uname) { 41 | this.uname = uname; 42 | } 43 | 44 | @Override 45 | public String toString() { 46 | return "User{" + 47 | "uid=" + uid + 48 | ", username='" + username + '\'' + 49 | ", pwd='" + pwd + '\'' + 50 | ", uname='" + uname + '\'' + 51 | '}'; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/smbms/services/goods/GoodsServices.java: -------------------------------------------------------------------------------- 1 | package smbms.services.goods; 2 | 3 | import smbms.pojo.Goods; 4 | 5 | import java.util.List; 6 | 7 | public interface GoodsServices { 8 | /** 9 | * @return 返回所有商品 10 | */ 11 | public List getAllGoods(); 12 | 13 | /** 14 | * @param listId 15 | * @return 返回分类商品 16 | */ 17 | public List getGoods(int listId); 18 | 19 | /** 20 | * @param gid 21 | * @return 22 | */ 23 | public Goods getGoodsByGid(int gid); 24 | 25 | public List getGoodsByName(String name); 26 | 27 | /** 28 | * @param gid 29 | * @param uid 30 | * @return 返回购物车表中受影响的行数 31 | */ 32 | public int insertgoods(int gid,int uid); 33 | 34 | /** 35 | * @param uid 36 | * @return 返回当前用户购物车中商品 37 | */ 38 | public List getCartGoods(int uid); 39 | 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/smbms/services/goods/GoodsServicesImpl.java: -------------------------------------------------------------------------------- 1 | package smbms.services.goods; 2 | 3 | import smbms.dao.BaseDao; 4 | import smbms.dao.goods.GoodsDao; 5 | import smbms.dao.goods.GoodsDaoImpl; 6 | import smbms.pojo.Goods; 7 | 8 | import java.sql.Connection; 9 | import java.sql.PreparedStatement; 10 | import java.util.ArrayList; 11 | import java.util.List; 12 | 13 | public class GoodsServicesImpl implements GoodsServices { 14 | GoodsDao goodsDao = new GoodsDaoImpl(); 15 | 16 | @Override 17 | public List getAllGoods() { 18 | List allGoods = new ArrayList<>(); 19 | Connection connection = BaseDao.getConnection(); 20 | if (null != connection) { 21 | try { 22 | allGoods = goodsDao.getAllGoods(connection); 23 | } catch (Exception e) { 24 | e.printStackTrace(); 25 | } finally { 26 | BaseDao.closeResource(connection, null, null); 27 | } 28 | } 29 | return allGoods; 30 | } 31 | 32 | @Override 33 | public List getGoods(int listId) { 34 | List allGoods = new ArrayList<>(); 35 | Connection connection = BaseDao.getConnection(); 36 | if (null != connection) { 37 | try { 38 | allGoods = goodsDao.getGoods(connection,listId); 39 | } catch (Exception e) { 40 | e.printStackTrace(); 41 | } finally { 42 | BaseDao.closeResource(connection, null, null); 43 | } 44 | } 45 | return allGoods; 46 | } 47 | 48 | @Override 49 | public Goods getGoodsByGid(int gid) { 50 | Connection connection = BaseDao.getConnection(); 51 | Goods goods =null; 52 | if(null!=connection){ 53 | goods = new Goods(); 54 | try { 55 | goods=goodsDao.getGoodsBygid(connection,gid); 56 | } catch (Exception e) { 57 | e.printStackTrace(); 58 | } finally { 59 | BaseDao.closeResource(connection, null, null); 60 | } 61 | } 62 | return goods; 63 | } 64 | 65 | @Override 66 | public List getGoodsByName(String name) { 67 | List goods = new ArrayList<>(); 68 | Connection connection = BaseDao.getConnection(); 69 | if(null!=connection){ 70 | try { 71 | goods = goodsDao.getGoodsByName(connection,name); 72 | } catch (Exception e) { 73 | e.printStackTrace(); 74 | }finally { 75 | BaseDao.closeResource(connection, null, null); 76 | } 77 | } 78 | return goods; 79 | } 80 | 81 | @Override 82 | public int insertgoods(int Gid, int Uid) { 83 | int updateRows = 0; 84 | Connection connection = BaseDao.getConnection(); 85 | if(null!=connection){ 86 | try { 87 | updateRows = goodsDao.insertGoods(connection, Gid, Uid); 88 | } catch (Exception e) { 89 | e.printStackTrace(); 90 | }finally { 91 | BaseDao.closeResource(connection, null, null); 92 | } 93 | } 94 | return updateRows; 95 | } 96 | 97 | @Override 98 | public List getCartGoods(int uid) { 99 | List goods = new ArrayList<>(); 100 | Connection connection = BaseDao.getConnection(); 101 | if(null!=connection){ 102 | try { 103 | goods = goodsDao.getCartGoods(connection, uid); 104 | } catch (Exception e) { 105 | e.printStackTrace(); 106 | }finally { 107 | BaseDao.closeResource(connection, null, null); 108 | } 109 | } 110 | return goods; 111 | } 112 | } 113 | -------------------------------------------------------------------------------- /src/main/java/smbms/services/user/UserServices.java: -------------------------------------------------------------------------------- 1 | package smbms.services.user; 2 | 3 | import smbms.pojo.User; 4 | 5 | import java.util.List; 6 | 7 | public interface UserServices { 8 | 9 | /** 10 | * 登录功能 11 | * @param username 12 | * @param userpassword 13 | * @return 14 | */ 15 | public User login(String username,String userpassword); 16 | 17 | public int register(); 18 | 19 | /** 20 | * 调用此方法返回一个List集合 21 | * @return 22 | */ 23 | public List getAllUsers(); 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/smbms/services/user/UserServicesImpl.java: -------------------------------------------------------------------------------- 1 | package smbms.services.user; 2 | 3 | import smbms.dao.BaseDao; 4 | import smbms.dao.user.UserDao; 5 | import smbms.dao.user.UserDaoImpl; 6 | import smbms.pojo.User; 7 | 8 | import java.sql.Connection; 9 | import java.sql.PreparedStatement; 10 | import java.sql.SQLException; 11 | import java.util.ArrayList; 12 | import java.util.List; 13 | 14 | /** 15 | * service层捕获异常,进行事务处理 16 | * 事务处理:调用不同dao的多个方法,必须使用同一个connection(connection作为参数传递) 17 | * 事务完成之后,需要在service层进行connection的关闭,在dao层关闭(PreparedStatement和ResultSet对象) 18 | */ 19 | public class UserServicesImpl implements UserServices { 20 | //本实现类中所有操作需要用到UserDao中方法,创建实现类对象 21 | private UserDao userDao; 22 | 23 | public UserServicesImpl() { 24 | userDao = new UserDaoImpl(); 25 | } 26 | 27 | /** 28 | * 调用getUser方法,获得user对象并返回 29 | * 30 | * @param username 31 | * @param userpassword 32 | * @return 33 | */ 34 | @Override 35 | public User login(String username, String userpassword) { 36 | Connection connection = null; 37 | User user = null; 38 | try { 39 | connection = BaseDao.getConnection(); 40 | user = userDao.getUser(connection, username); 41 | } catch (Exception e) { 42 | e.printStackTrace(); 43 | } finally { 44 | BaseDao.closeResource(connection, null, null); 45 | } 46 | 47 | return user; 48 | } 49 | 50 | @Override 51 | public int register() { 52 | return 0; 53 | } 54 | 55 | /** 56 | * @return 57 | */ 58 | @Override 59 | public List getAllUsers() { 60 | Connection connection = null; 61 | List allUsers = null; 62 | try { 63 | connection = BaseDao.getConnection(); 64 | allUsers =new ArrayList<>(); 65 | if (connection!=null){ 66 | allUsers = userDao.getAllUsers(connection); 67 | } 68 | } catch (Exception e) { 69 | e.printStackTrace(); 70 | } finally { 71 | BaseDao.closeResource(connection, null, null); 72 | } 73 | return allUsers; 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /src/main/java/smbms/servlet/CartShowServlet.java: -------------------------------------------------------------------------------- 1 | package smbms.servlet; 2 | 3 | import smbms.pojo.Goods; 4 | import smbms.services.goods.GoodsServices; 5 | import smbms.services.goods.GoodsServicesImpl; 6 | import smbms.tools.Constants; 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 | import java.util.List; 15 | 16 | @WebServlet(name = "CartShowServlet",urlPatterns = "/jsp/cartshow.do") 17 | public class CartShowServlet extends HttpServlet { 18 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 19 | String uid = request.getParameter("uid"); 20 | int num = Integer.parseInt(uid); 21 | GoodsServices goodsServices = new GoodsServicesImpl(); 22 | List cartGoods = goodsServices.getCartGoods(num); 23 | request.setAttribute(Constants.CARTGOODS,cartGoods); 24 | request.getRequestDispatcher("/jsp/shoppingcart.jsp").forward(request,response); 25 | 26 | } 27 | 28 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 29 | doPost(request,response); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/smbms/servlet/GoodsInfoServlet.java: -------------------------------------------------------------------------------- 1 | package smbms.servlet; 2 | 3 | import smbms.pojo.Goods; 4 | import smbms.services.goods.GoodsServices; 5 | import smbms.services.goods.GoodsServicesImpl; 6 | import smbms.services.user.UserServices; 7 | import smbms.services.user.UserServicesImpl; 8 | import smbms.tools.Constants; 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.IOException; 16 | 17 | @WebServlet(name = "GoodsInfoServlet", urlPatterns = "/jsp/goodsinfo.do") 18 | public class GoodsInfoServlet extends HttpServlet { 19 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 20 | String method = request.getParameter("method"); 21 | int num= Integer.parseInt(method); 22 | 23 | System.out.println(num); 24 | GoodsServices goodsServices = new GoodsServicesImpl(); 25 | Goods goods = goodsServices.getGoodsByGid(num); 26 | //System.out.println(goods); 27 | request.setAttribute(Constants.GOODSINFO,goods); 28 | request.getRequestDispatcher("/jsp/buygoods.jsp").forward(request,response); 29 | } 30 | 31 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 32 | doPost(request, response); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/smbms/servlet/GoodsShowServlet.java: -------------------------------------------------------------------------------- 1 | package smbms.servlet; 2 | 3 | import jdk.swing.interop.SwingInterOpUtils; 4 | import smbms.pojo.Goods; 5 | import smbms.services.goods.GoodsServices; 6 | import smbms.services.goods.GoodsServicesImpl; 7 | import smbms.services.user.UserServices; 8 | import smbms.services.user.UserServicesImpl; 9 | import smbms.tools.Constants; 10 | 11 | import javax.servlet.ServletException; 12 | import javax.servlet.annotation.WebServlet; 13 | import javax.servlet.http.HttpServlet; 14 | import javax.servlet.http.HttpServletRequest; 15 | import javax.servlet.http.HttpServletResponse; 16 | import java.io.IOException; 17 | import java.util.ArrayList; 18 | import java.util.List; 19 | 20 | //TODO 商品展示功能 21 | @WebServlet(name = "GoodsShowServlet", urlPatterns = "/jsp/goodsshow.do") 22 | public class GoodsShowServlet extends HttpServlet { 23 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 24 | 25 | List allGoods = new ArrayList<>(); 26 | GoodsServices goodsServices = new GoodsServicesImpl(); 27 | allGoods = goodsServices.getAllGoods(); 28 | if (null != allGoods) {//为空 29 | request.setAttribute(Constants.GOODSSLISt, allGoods); 30 | request.getRequestDispatcher("/jsp/goodsshow.jsp").forward(request, response); 31 | } else { 32 | request.setAttribute(Constants.GOODSSLISt, "当前暂无商品可售"); 33 | request.getRequestDispatcher("/jsp/goodsshow.jsp").forward(request, response); 34 | } 35 | 36 | } 37 | 38 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 39 | doPost(request, response); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/smbms/servlet/InsertGoodsServlet.java: -------------------------------------------------------------------------------- 1 | package smbms.servlet; 2 | 3 | import smbms.services.goods.GoodsServices; 4 | import smbms.services.goods.GoodsServicesImpl; 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(name = "InsertGoodsServlet", urlPatterns = "/jsp/insertgoods.do") 14 | public class InsertGoodsServlet extends HttpServlet { 15 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 16 | String gid = request.getParameter("gid"); 17 | String uid = request.getParameter("uid"); 18 | 19 | int num1 = Integer.parseInt(gid); 20 | int num2 = Integer.parseInt(uid); 21 | 22 | GoodsServices goodsServices =new GoodsServicesImpl(); 23 | int insertgoods = goodsServices.insertgoods(num1, num2); 24 | /* 25 | TODO :解决添加重复商品,以及使用js实现添加成功 26 | */ 27 | 28 | //System.out.println(insertgoods); 29 | //response.sendRedirect("/jsp/goodsshow.do"); 30 | 31 | } 32 | 33 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 34 | doPost(request, response); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/smbms/servlet/ListedGoodsServlet.java: -------------------------------------------------------------------------------- 1 | package smbms.servlet; 2 | 3 | import smbms.pojo.Goods; 4 | import smbms.services.goods.GoodsServices; 5 | import smbms.services.goods.GoodsServicesImpl; 6 | import smbms.tools.Constants; 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 | import java.util.ArrayList; 15 | import java.util.List; 16 | 17 | @WebServlet(name = "ListedGoodsServlet", urlPatterns = "/jsp/listedgoods.do") 18 | public class ListedGoodsServlet extends HttpServlet { 19 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 20 | String method = request.getParameter("method"); 21 | int num =1; 22 | List Goods = new ArrayList<>(); 23 | GoodsServices goodsServices = new GoodsServicesImpl(); 24 | num = Integer.parseInt(method.trim()); 25 | Goods = goodsServices.getGoods(num); 26 | if (null != Goods){//为空 27 | request.setAttribute(Constants.GOODSSLISt, Goods); 28 | request.getRequestDispatcher("/jsp/goodsshow.jsp").forward(request, response); 29 | } else { 30 | request.setAttribute(Constants.GOODSSLISt, "当前暂无商品可售"); 31 | request.getRequestDispatcher("/jsp/goodsshow.jsp").forward(request, response); 32 | } 33 | 34 | } 35 | 36 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 37 | doPost(request, response); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/smbms/servlet/LoginServlet.java: -------------------------------------------------------------------------------- 1 | package smbms.servlet; 2 | 3 | import smbms.pojo.User; 4 | import smbms.services.user.UserServices; 5 | import smbms.services.user.UserServicesImpl; 6 | import smbms.tools.Constants; 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 | @WebServlet(name = "LoginServlet", urlPatterns = "/login.do") 16 | public class LoginServlet extends HttpServlet { 17 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 18 | String username = request.getParameter("username"); 19 | String password = request.getParameter("userpassword"); 20 | 21 | //调用login方法 22 | UserServices userService = new UserServicesImpl(); 23 | User user = userService.login(username, password); 24 | if (null != user) { //user不为空,判断密码 25 | if (user.getPwd().equals(password)) {//密码正确 26 | request.getSession().setAttribute(Constants.USER_SESSION, user); 27 | request.getRequestDispatcher(request.getContextPath()+"jsp/frame.jsp").forward(request, response); 28 | } else {//密码不正确 29 | // System.out.println("密码不正确"); 30 | request.setAttribute(Constants.ERROR, "密码不正确"); 31 | response.sendRedirect("/login.jsp"); 32 | } 33 | } else {//用户名不正确 34 | // System.out.println("用户名不正确"); 35 | request.setAttribute(Constants.ERROR, "用户名不正确"); 36 | response.sendRedirect("/login.jsp"); 37 | } 38 | //TODO 前端获取不到这个值 39 | //System.out.println(request.getAttribute(Constants.ERROR)); 40 | } 41 | 42 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 43 | doPost(request,response); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/smbms/servlet/LogoutServlet.java: -------------------------------------------------------------------------------- 1 | package smbms.servlet; 2 | 3 | import smbms.tools.Constants; 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 | /** 13 | * 移除session,并重定向到登录页面 14 | * TODO:实现过滤器拦截,一旦退出后无法进入主界面 15 | */ 16 | @WebServlet(name = "LogoutServlet",urlPatterns = "/jsp/logout.do") 17 | public class LogoutServlet extends HttpServlet { 18 | @Override 19 | public void doGet(HttpServletRequest request, HttpServletResponse response) 20 | throws ServletException, IOException { 21 | doPost(request, response); 22 | } 23 | 24 | @Override 25 | public void doPost(HttpServletRequest request, HttpServletResponse response) 26 | throws ServletException, IOException { 27 | //清除session 28 | request.getSession().removeAttribute(Constants.USER_SESSION); 29 | response.sendRedirect(request.getContextPath()+"/login.jsp"); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/smbms/servlet/SecListedServlet.java: -------------------------------------------------------------------------------- 1 | package smbms.servlet; 2 | 3 | import smbms.pojo.Goods; 4 | import smbms.services.goods.GoodsServices; 5 | import smbms.services.goods.GoodsServicesImpl; 6 | import smbms.tools.Constants; 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 | import java.util.ArrayList; 15 | import java.util.List; 16 | 17 | @WebServlet(name = "SecListedServlet",urlPatterns = "/jsp/seclisted.do") 18 | public class SecListedServlet extends HttpServlet { 19 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 20 | //TODO 21 | String name = request.getParameter("name"); 22 | 23 | System.out.println(name); 24 | 25 | List allGoods = new ArrayList<>(); 26 | GoodsServices goodsServices = new GoodsServicesImpl(); 27 | allGoods = goodsServices.getGoodsByName(name); 28 | 29 | System.out.println(allGoods); 30 | 31 | if (null != allGoods) {//为空 32 | request.setAttribute(Constants.GOODSSLISt, allGoods); 33 | request.getRequestDispatcher("/jsp/goodsshow.jsp").forward(request, response); 34 | } else { 35 | request.setAttribute(Constants.GOODSSLISt, "当前暂无商品可售"); 36 | request.getRequestDispatcher("/jsp/goodsshow.jsp").forward(request, response); 37 | } 38 | } 39 | 40 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 41 | doPost(request, response); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/smbms/servlet/UserShowServlet.java: -------------------------------------------------------------------------------- 1 | package smbms.servlet; 2 | 3 | import smbms.pojo.User; 4 | import smbms.services.user.UserServices; 5 | import smbms.services.user.UserServicesImpl; 6 | import smbms.tools.Constants; 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 | import java.util.ArrayList; 15 | import java.util.List; 16 | 17 | @WebServlet(name = "UserShowServlet",urlPatterns = "/jsp/usershow.do") 18 | public class UserShowServlet extends HttpServlet { 19 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 20 | List alluser = new ArrayList<>(); 21 | UserServices userServices = new UserServicesImpl(); 22 | alluser = userServices.getAllUsers(); 23 | System.out.println(alluser); 24 | if(alluser!=null){//用户名不为空 25 | request.setAttribute(Constants.ALLUSERMESSAGE,alluser); 26 | System.out.println("21231"); 27 | request.getRequestDispatcher("/jsp/usershow.jsp").forward(request,response); 28 | } 29 | 30 | 31 | } 32 | 33 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 34 | doPost(request,response); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/smbms/tools/Constants.java: -------------------------------------------------------------------------------- 1 | package smbms.tools; 2 | 3 | /** 4 | * 自定义的Constants存放常量,方便前端jsp页面调用 5 | * */ 6 | public class Constants { 7 | 8 | public final static String USER_SESSION = "userSession"; 9 | public final static String ERROR = "error"; 10 | public final static String ALLUSERMESSAGE = "allUserMessage"; 11 | public final static String GOODSSLISt = "goodslist"; 12 | public final static String GOODSINFO = "goodsinfo"; 13 | public final static String CARTGOODS = "cartgoods"; 14 | } -------------------------------------------------------------------------------- /src/main/resources/db.properties: -------------------------------------------------------------------------------- 1 | driver=com.mysql.jdbc.Driver 2 | url=jdbc:mysql://127.0.0.1:3306/lokismbms?useUnicode=true&characterEncoding=utf8 3 | user=root 4 | password=root -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | login.jsp 9 | 10 | -------------------------------------------------------------------------------- /src/main/webapp/css/cube.css: -------------------------------------------------------------------------------- 1 | html{ 2 | perspective: 800px; 3 | } 4 | .cube img{ 5 | width: 200px; 6 | height: 200px; 7 | } 8 | .cube{ 9 | width: 200px; 10 | height: 200px; 11 | margin: 200px auto; 12 | /*3D变形效果*/ 13 | transform-style: preserve-3d; 14 | animation: rotate linear 10s infinite; 15 | } 16 | .cube > div{ 17 | position: absolute; 18 | opacity: 0.9; 19 | } 20 | img{ 21 | vertical-align: top; 22 | } 23 | .box1{ 24 | transform: rotateY(90deg) translateZ(100px); 25 | 26 | } 27 | .box2{ 28 | transform: rotateY(-90deg) translateZ(100px); 29 | } 30 | .box3{ 31 | transform: rotateX(90deg) translateZ(100px); 32 | } 33 | .box4{ 34 | transform: rotateX(-90deg) translateZ(100px); 35 | } 36 | .box5{ 37 | transform: rotateY(180deg) translateZ(100px); 38 | } 39 | .box6{ 40 | transform: rotateY(0deg) translateZ(100px); 41 | } 42 | @keyframes rotate{ 43 | from{ 44 | transform: rotateX(0) rotateZ(0); 45 | } 46 | to{ 47 | transform: rotateX(1turn) rotateZ(1turn); 48 | } 49 | } -------------------------------------------------------------------------------- /src/main/webapp/css/public.css: -------------------------------------------------------------------------------- 1 | *{ 2 | margin: 0; 3 | padding: 0; 4 | } 5 | body{ 6 | font-size: 12px; 7 | background: #4287c2; 8 | } 9 | .clear:after{ 10 | content: ''; 11 | display: block; 12 | clear: both; 13 | } 14 | a{ 15 | text-decoration: none; 16 | } 17 | li{ 18 | list-style: none; 19 | } 20 | 21 | /*公共样式,头部*/ 22 | .publicHeader{ 23 | height: 48px; 24 | line-height: 48px; 25 | font-size: 14px; 26 | background: linear-gradient(to bottom,#60acf0,#64a5df,#62a0dd,#5994d6,#4f8ace,#4880ca); 27 | background:-webkit-linear-gradient(to bottom,#60acf0,#64a5df,#62a0dd,#5994d6,#4f8ace,#4880ca); 28 | background:-moz-linear-gradient(to bottom,#60acf0,#64a5df,#62a0dd,#5994d6,#4f8ace,#4880ca); 29 | background:-ms-linear-gradient(to bottom,#60acf0,#64a5df,#62a0dd,#5994d6,#4f8ace,#4880ca); 30 | } 31 | .publicHeader h1{ 32 | float: left; 33 | color: #fff; 34 | font-size: 22px; 35 | padding-left:80px; 36 | text-shadow: 2px 1px #000; 37 | background: url("../images/buy.png") 30px center no-repeat; 38 | 39 | } 40 | .publicHeaderR{ 41 | float: right; 42 | color: #fff; 43 | margin-right: 50px; 44 | 45 | } 46 | .publicHeaderR p{ 47 | display: inline-block; 48 | font-weight: bold; 49 | } 50 | .publicHeaderR a{ 51 | width: 50px; 52 | height: 28px; 53 | display: inline-block; 54 | border: 1px solid #679e43; 55 | background: linear-gradient(to bottom,#baf076,#a2d866,#9cd055,#8dc838,#8bc93a); 56 | line-height: 28px; 57 | text-align: center; 58 | border-radius: 4px; 59 | font-weight: bold; 60 | color: #fff; 61 | 62 | } 63 | .publicHeaderR a:hover,.publicHeaderR a:active{ 64 | border: 1px solid #192b02; 65 | border-radius: 4px; 66 | font-weight: bold; 67 | background: linear-gradient(to bottom,#70b21c,#5c9613,#47740e,#3b6209,#2b4906); 68 | } 69 | /*时间*/ 70 | .publicTime{ 71 | height: 28px; 72 | line-height: 28px; 73 | font-size: 12px; 74 | background: linear-gradient(to bottom,#f5f9f8,#eef2fb,#e2ecf5,#e2ecf5,#e0edf6); 75 | padding-left: 20px; 76 | color: #808589; 77 | } 78 | #time{ 79 | float: left; 80 | background: url("../images/time.png") 0 center no-repeat; 81 | padding-left: 26px; 82 | } 83 | .publicTime a{ 84 | float: right; 85 | margin-right: 50px; 86 | color: #626367; 87 | } 88 | 89 | /*公共部分主体内容*/ 90 | .publicMian{ 91 | border-top: 1px solid #c2ccd5; 92 | display: flex; /*变为弹性盒模型*/ 93 | display: -webkit-flex; 94 | background-color: rgb(244,244,244); 95 | 96 | } 97 | /*左边*/ 98 | .left{ 99 | width: 168px; 100 | background: url("../images/leftBg.png") 0 0 repeat-y; 101 | margin-right: 10px; 102 | /*height: 520px;*/ 103 | min-height: 520px; 104 | 105 | } 106 | .leftH2{ 107 | width: 140px; 108 | height: 30px; 109 | border-radius: 4px; 110 | line-height: 30px; 111 | text-align: center; 112 | color: #fff; 113 | background: #60b3e7; 114 | margin: 10px auto; 115 | box-shadow:4px 4px rgba(212,212,212,0.7); 116 | } 117 | .leftH2 span{ 118 | width: 10px; 119 | height: 10px; 120 | display: inline-block; 121 | background: radial-gradient(#70c2f4,#3a8dc1, #035384, #4696c7,#83d1f5); 122 | border-radius: 50%; 123 | } 124 | .span1{ 125 | margin-right: 10px; 126 | } 127 | .span2{ 128 | margin-left: 12px; 129 | } 130 | 131 | .list{ 132 | margin: 0 20px; 133 | font-weight: bold; 134 | } 135 | .list li{ 136 | height: 40px; 137 | line-height: 40px; 138 | border-bottom: 1px solid rgba(212,212,212,0.5) ; 139 | } 140 | .list li:nth-child(1){ 141 | background: url("../images/zd.png") 0 center no-repeat; 142 | } 143 | .list li:nth-child(2){ 144 | background: url("../images/gys.png") 0 center no-repeat; 145 | } 146 | .list li:nth-child(3){ 147 | background: url("../images/yh.png") 0 center no-repeat; 148 | } 149 | .list li:nth-child(4){ 150 | background: url("../images/mm.png") 0 center no-repeat; 151 | } 152 | .list li:nth-child(5){ 153 | background: url("../images/tc.png") 0 center no-repeat; 154 | } 155 | .list li:hover{ 156 | background-color: #acd5f5; 157 | border-radius: 4px; 158 | } 159 | .list li:active, #active{ 160 | background-color: #92c609; 161 | border-radius: 4px; 162 | } 163 | .list a{ 164 | color: #0042a8; 165 | display: inline-block; 166 | padding-left: 40px; 167 | width: 90%; 168 | } 169 | 170 | 171 | /*右边*/ 172 | .right{ 173 | width: 85%; 174 | } 175 | /*右边所在位置栏*/ 176 | .location{ 177 | height: 30px; 178 | line-height: 30px; 179 | border: 1px solid #e6eaf6; 180 | border-radius: 8px; 181 | background: linear-gradient(to bottom, #fefefe,#ffffff,#f6fafd); 182 | color: #4a4a4a; 183 | padding-left: 30px; 184 | } 185 | .location strong{ 186 | background: url("../images/home.png") 0 center no-repeat; 187 | display: inline-block; 188 | padding-left: 30px; 189 | } 190 | .location span{ 191 | color: #2179a9; 192 | font-weight: bold; 193 | } 194 | /*搜索信息栏*/ 195 | .search{ 196 | height:50px; 197 | line-height:50px; 198 | background: #f6fafd; 199 | padding-left: 24px; 200 | color: #000; 201 | } 202 | .search input[type='text']{ 203 | width: 200px; 204 | height: 30px; 205 | outline: none; 206 | padding-left: 10px; 207 | border: 1px solid #8ab2d5; 208 | border-radius: 4px; 209 | } 210 | .search input[type='button']{ 211 | margin-left: 20px; 212 | width: 100px; 213 | padding: 0 20px; 214 | height: 30px; 215 | border: 1px solid #7ba92c; 216 | border-radius: 4px; 217 | color: #fff; 218 | font-weight: bold; 219 | background:#87c212 url("../images/search.png") 10px center no-repeat; 220 | } 221 | .search input[type='button']:focus{ 222 | outline: none; 223 | background-color: #5d8410; 224 | } 225 | .search a{ 226 | width: 80px; 227 | padding-left:40px; 228 | float: right; 229 | margin: 10px 60px; 230 | height: 30px; 231 | line-height: 30px; 232 | border: 1px solid #0c89de; 233 | border-radius: 4px; 234 | color: #fff; 235 | font-weight: bold; 236 | background:#47acf1 url("../images/tianjia.png") 10px center no-repeat; 237 | display: inline-block; 238 | } 239 | .search a:hover,.search a:active{ 240 | background-color: #0778c5; 241 | } 242 | .search span{ 243 | margin-left: 10px; 244 | } 245 | .search select{ 246 | margin: 10px; 247 | width: 100px; 248 | height: 30px; 249 | border-radius: 4px; 250 | border: 1px solid #0c89de; 251 | outline: none; 252 | } 253 | 254 | /*底部*/ 255 | .footer{ 256 | width: 100%; 257 | line-height: 40px; 258 | text-align: center; 259 | color: #fff; 260 | } 261 | 262 | #searchbutton{ 263 | margin-left: 20px; 264 | width: 100px; 265 | padding: 0 20px; 266 | height: 30px; 267 | border: 1px solid #7ba92c; 268 | border-radius: 4px; 269 | color: #fff; 270 | font-weight: bold; 271 | background:#87c212 url("../images/search.png") 10px center no-repeat; 272 | } 273 | #searchbutton:focus{ 274 | outline: none; 275 | background-color: #5d8410; 276 | } 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | -------------------------------------------------------------------------------- /src/main/webapp/css/style.css: -------------------------------------------------------------------------------- 1 | * { 2 | margin: 0; 3 | padding: 0; 4 | } 5 | .clearfix:before, 6 | .clearfix:after{ 7 | content:""; 8 | /*after和before默认是行内元素,需转换为块元素*/ 9 | /*table 既可以解决高度塌陷,又可以解决外边距重叠*/ 10 | display: table; 11 | clear: both; 12 | } 13 | 14 | /*登录页面*/ 15 | .login_bg { 16 | background: url("../images/loginBg.jpg") 0 0 repeat-x; 17 | } 18 | 19 | .loginBox { 20 | width: 1000px; 21 | margin: 0 auto; 22 | background: url("../images/login_bg.jpg") 0 0 no-repeat; 23 | } 24 | 25 | .loginHeader { 26 | padding-top: 102px; 27 | text-align: center; 28 | padding-bottom: 30px; 29 | } 30 | 31 | .loginHeader h1 { 32 | color: #fff; 33 | text-shadow: 2px 2px #000; 34 | } 35 | 36 | .loginCont { 37 | width: 388px; 38 | height: 284px; 39 | /*border: 1px solid red ;*/ 40 | margin: 0 auto; 41 | } 42 | 43 | .formBox { 44 | position: relative; 45 | } 46 | 47 | /*输入框里默认输入字体*/ 48 | ::-webkit-input-placeholder { 49 | color: rgb(190, 188, 188); 50 | /*font-style: italic;*/ 51 | } 52 | 53 | input:-moz-placeholder, 54 | textarea:-moz-placeholder { 55 | color: rgb(190, 188, 188); 56 | font-style: italic; 57 | } 58 | 59 | input { 60 | outline: none; 61 | } 62 | 63 | .loginForm { 64 | background: url("../images/formBg.png") 0 0 no-repeat; 65 | width: 320px; 66 | height: 140px; 67 | border-radius: 8px; 68 | padding: 90px 38px 48px 30px; 69 | /*border: 1px solid green;*/ 70 | } 71 | 72 | .loginForm label { 73 | width: 20%; 74 | display: inline-block; 75 | } 76 | 77 | .inputbox { 78 | height: 60px; 79 | } 80 | 81 | .info { 82 | color: red; 83 | font-weight:bold; 84 | } 85 | 86 | .inputbox input { 87 | width: 66%; 88 | padding: 10px 5px 10px 20px; 89 | border: 1px solid rgb(178, 178, 178); 90 | border-radius: 3px; 91 | -webkit-box-shadow: 0px 1px 4px 0px rgba(168, 168, 168, 0.6) inset; 92 | -moz-box-shadow: 0px 1px 4px 0px rgba(168, 168, 168, 0.6) inset; 93 | box-shadow: 0px 1px 4px 0px rgba(168, 168, 168, 0.6) inset; 94 | 95 | } 96 | 97 | /*输入框得到焦点的效果*/ 98 | .inputbox input:active, .providerAdd input:focus, 99 | .inputbox input:focus { 100 | border: 1px solid rgba(91, 90, 90, 0.7); 101 | background: rgba(238, 236, 240, 0.2); 102 | -webkit-box-shadow: 0px 1px 4px 0px rgba(168, 168, 168, 0.9) inset; 103 | -moz-box-shadow: 0px 1px 4px 0px rgba(168, 168, 168, 0.9) inset; 104 | box-shadow: 0px 1px 4px 0px rgba(168, 168, 168, 0.9) inset; 105 | } 106 | 107 | .subBtn { 108 | margin-left: 70px; 109 | } 110 | input[type='submit'], .subBtn a { 111 | cursor: pointer; 112 | background: #54a4d7; 113 | padding: 6px 18px; 114 | font-family: 'BebasNeueRegular', 'Arial Narrow', Arial, sans-serif; 115 | color: #fff; 116 | font-size: 18px; 117 | border: 1px solid #4682be; 118 | margin-bottom: 10px; 119 | margin-right: 22px; 120 | text-shadow: 0 1px 1px rgba(0, 0, 0, 0.5); 121 | -webkit-border-radius: 3px; 122 | -moz-border-radius: 3px; 123 | border-radius: 3px; 124 | -webkit-box-shadow: 0px 1px 4px 4px rgba(0, 0, 0, 0.07) inset, 125 | 0px 0px 0px 3px rgb(254, 254, 254), 126 | 0px 5px 3px 3px rgb(210, 210, 210); 127 | -moz-box-shadow: 0px 1px 4px 4px rgba(0, 0, 0, 0.07) inset, 128 | 0px 0px 0px 3px rgb(254, 254, 254), 129 | 0px 5px 3px 3px rgb(210, 210, 210); 130 | box-shadow: 0px 1px 4px 4px rgba(0, 0, 0, 0.07) inset, 131 | 0px 0px 0px 3px rgb(254, 254, 254), 132 | 0px 5px 3px 3px rgb(210, 210, 210); 133 | 134 | } 135 | .subBtn a{ 136 | text-decoration: none; 137 | margin-bottom: 3px; 138 | } 139 | 140 | input[type='submit']:hover, input[type='reset']:hover { 141 | background: rgb(74, 179, 198); 142 | } 143 | 144 | input[type='submit']:active, input[type='submit']:focus{ 145 | background: #2a5989; 146 | border: 1px solid rgb(12, 76, 87); 147 | -webkit-box-shadow: 0px 1px 6px 4px rgba(0, 0, 0, 0.2) inset; 148 | -moz-box-shadow: 0px 1px 6px 4px rgba(0, 0, 0, 0.2) inset; 149 | box-shadow: 0px 1px 6px 4px rgba(0, 0, 0, 0.2) inset; 150 | } 151 | 152 | /*欢迎登录页*/ 153 | .wColck { 154 | width: 88px; 155 | height: 108px; 156 | margin: 50px; 157 | float: left; 158 | } 159 | 160 | .wFont { 161 | float: left; 162 | margin-top: 50px; 163 | margin-left: 50px; 164 | } 165 | 166 | .wFont h2 { 167 | font-size: 50px; 168 | line-height: 50px; 169 | color: #0a5eb6; 170 | margin-bottom: 40px; 171 | } 172 | 173 | .wFont p { 174 | font-size: 28px; 175 | line-height: 30px; 176 | color: #5a656c; 177 | } 178 | /*供应商管理页面-->供应商添加页面*/ 179 | .providerAdd { 180 | border: 1px solid #9ac70f; 181 | padding: 20px; 182 | margin: 20px; 183 | } 184 | 185 | .providerAdd form { 186 | 187 | } 188 | 189 | .providerAdd div { 190 | margin-top: 12px; 191 | margin-bottom: 12px; 192 | } 193 | 194 | .providerAdd label { 195 | width: 200px; 196 | display: inline-block; 197 | text-align: right; 198 | } 199 | 200 | .providerAdd input ,.providerAdd select{ 201 | width: 260px; 202 | height: 30px; 203 | line-height: 30px; 204 | border-radius: 4px; 205 | outline: none; 206 | padding-left: 10px; 207 | border: 1px solid #4987c0; 208 | box-shadow: 1px 1px 1px #99afc4; 209 | } 210 | 211 | .providerAdd input:focus,.providerAdd select:focus { 212 | border: 1px solid #0e56a8; 213 | background: rgba(238, 236, 240, 0.2); 214 | -webkit-box-shadow: 0px 1px 4px 0px rgba(168, 168, 168, 0.9) inset; 215 | -moz-box-shadow: 0px 1px 4px 0px rgba(168, 168, 168, 0.9) inset; 216 | box-shadow: 0px 1px 4px 0px rgba(168, 168, 168, 0.9) inset; 217 | } 218 | 219 | .providerAdd span { 220 | margin-left: 20px; 221 | color: #faca0d; 222 | } 223 | 224 | /*验证错误*/ 225 | .providerAdd .error span { 226 | color: red; 227 | } 228 | 229 | .providerAdd .error input { 230 | border: 1px solid red; 231 | } 232 | 233 | /*验证成功*/ 234 | .providerAdd .ok span { 235 | color: green; 236 | } 237 | 238 | .providerAdd .ok input { 239 | border: 1px solid green; 240 | } 241 | 242 | .providerAddBtn { 243 | margin-left: 240px; 244 | padding-top: 20px; 245 | } 246 | 247 | .providerAddBtn a , 248 | .providerAddBtn input[type='submit'], 249 | .providerAddBtn input[type='button'] { 250 | display: inline-block; 251 | width: 100px; 252 | height: 30px; 253 | line-height: 30px; 254 | text-align: center; 255 | border-radius: 4px; 256 | border: transparent; 257 | background: linear-gradient(to bottom, #85c0ec, #6aa7d6, #508dc6, #306fb4, #17559e); 258 | color: #fff; 259 | cursor: pointer; 260 | font-weight: bold; 261 | font-size: 14px; 262 | vertical-align: top; 263 | } 264 | 265 | .providerAddBtn a:active, 266 | .providerAddBtn a:focus, 267 | .providerAddBtn a:hover, 268 | .providerAddBtn input[type='submit']:hover, 269 | .providerAddBtn input[type='submit']:focus{ 270 | background: linear-gradient(to bottom, #7aaed4, #578bb4, #406e99, #225792, #0d2d54); 271 | } 272 | 273 | .providerAdd input[type='radio']{ 274 | width: 20px; 275 | height: 14px; 276 | line-height:12px; 277 | border-radius: 4px; 278 | outline: none; 279 | padding-left: 10px; 280 | border: none; 281 | box-shadow: none; 282 | } 283 | 284 | /*商品展示界面*/ 285 | .goodsbar{ 286 | background-color: rgb(244,244,244); 287 | } 288 | .goods_nav{ 289 | width: 1210px; 290 | height: 48px; 291 | margin: 5px 20px auto; 292 | background-color: rgb(172,213,245); 293 | line-height: 48px; 294 | display: flex; 295 | } 296 | .goods_nav li{ 297 | list-style: none; 298 | /*设置增长系数*/ 299 | flex-grow: 1; 300 | text-align: center; 301 | 302 | } 303 | .goods_nav a{ 304 | display: block; 305 | color: #808080; 306 | text-decoration: none; 307 | font-weight: bold; 308 | font-family: YouYuan; 309 | font-size: 20px; 310 | 311 | } 312 | .goods_nav a:hover{ 313 | background-color: rgb(66,135,194); 314 | color: #fff; 315 | } 316 | 317 | /*鼠标接触显示*/ 318 | .app:hover .drop_down_menu, 319 | .app:hover::after{ 320 | display: block; 321 | height: auto; 322 | } 323 | 324 | /*下拉菜单*/ 325 | .app{ 326 | position: relative; 327 | } 328 | 329 | .app .drop_down_menu{ 330 | width: 242px !important; 331 | /*隐藏元素*/ 332 | width: 242px; 333 | height:0px; 334 | overflow:hidden !important; 335 | /*弹出层不应该占据父元素位置,所以开启绝对定位*/ 336 | position: absolute; 337 | line-height: 1; 338 | text-align: center; 339 | background-color: rgb(172,213,245); 340 | box-shadow: 0 0 10px rgba(0, 0, 0, .3); 341 | /*为元素设置过渡效果*/ 342 | transition: height 0.5s; 343 | z-index: 9999; 344 | } 345 | .drop_down_menu object a{ 346 | padding: 10px; 347 | } 348 | 349 | 350 | .goodsshow{ 351 | width: 1355px; 352 | padding-left: 10px; 353 | } 354 | .show_goods{ 355 | margin: 5px; 356 | float: left; 357 | background-color: white; 358 | padding-bottom: 20px; 359 | border-radius: 35px; 360 | border: 1px solid lightpink; 361 | } 362 | .show_goods_img{ 363 | height: 350px; 364 | width: 350px; 365 | padding: 20px 20px; 366 | margin: 10px 5px; 367 | 368 | } 369 | 370 | .show_goods_img img{ 371 | height: 300px; 372 | width: 300px; 373 | padding: 20px; 374 | } 375 | #price{ 376 | 377 | font-family: math; 378 | color: red; 379 | font-weight:bold; 380 | font-size: 20px; 381 | float: right; 382 | margin-right: 20px; 383 | } 384 | #goods_name{ 385 | font-family: math; 386 | color: black; 387 | font-weight:bold; 388 | font-size: 20px; 389 | float: left; 390 | margin-left: 20px; 391 | } 392 | /*商品详情界面*/ 393 | .goodsinfobar{ 394 | border: 2px solid pink; 395 | padding-top: 126px; 396 | padding-left: 62px; 397 | margin-bottom: 50px; 398 | margin-top: 50px; 399 | border-radius: 45px; 400 | } 401 | .rightinfobar{ 402 | position: relative; 403 | left: 593px; 404 | bottom: 403px; 405 | } 406 | .info_desc{ 407 | width: 452px; 408 | font-family:'PingHei','Helvetica Neue','Helvetica','Arial','Verdana','sans-serif'; 409 | font-size: 17px; 410 | font-weight: bold; 411 | color: black; 412 | } 413 | .info_img img{ 414 | width: 350px; 415 | } 416 | .info_price{ 417 | font-family:'PingHei','Helvetica Neue','Helvetica','Arial','Verdana','sans-serif'; 418 | font-size: 60px; 419 | } 420 | .info_a a:hover{ 421 | text-decoration-line: underline; 422 | color: orange !important; 423 | } 424 | .info_a a{ 425 | text-decoration: none; 426 | padding: 5px; 427 | font-size: 28px; 428 | color: black; 429 | font-family: 'PingHei','Helvetica Neue','Helvetica','Arial','Verdana','sans-serif'; 430 | } 431 | .info_a input{ 432 | padding: 5px; 433 | font-size: 30px; 434 | color: black; 435 | font-family: 'PingHei','Helvetica Neue','Helvetica','Arial','Verdana','sans-serif'; 436 | } 437 | .showAllUsers{ 438 | margin-top: 40px; 439 | } 440 | .showAllUsers table{ 441 | margin: 0 auto; 442 | width: 90%; 443 | border: 1px solid black; 444 | /*边框之间的距离*/ 445 | border-spacing: 0px; 446 | /*设置边框的合并*/ 447 | /* border-collapse:collapse; */ 448 | background-color: lightcoral; 449 | } 450 | .showAllUsers td,tr,th{ 451 | border: 1px solid black; 452 | 453 | } 454 | .showAllUsers tr{ 455 | height: 30px; 456 | } 457 | .showAllUsers table tr:nth-child(odd){ 458 | background-color: #bfa; 459 | } 460 | .showAllUsers table tr:hover{ 461 | background-color: gray; 462 | } 463 | 464 | /*购物车界面*/ 465 | .cartlogcontent{ 466 | width: 100%; 467 | margin: 5px; 468 | background-color: white; 469 | border-radius: 35px; 470 | } 471 | .contentimg{ 472 | height: 120px; 473 | padding: 20px 20px; 474 | margin: 10px 5px; 475 | } 476 | .contentimg img{ 477 | height: 150px; 478 | width: 150px; 479 | } 480 | .contentdesc{ 481 | 482 | } 483 | #contentname{ 484 | font-family: math; 485 | color: black; 486 | font-weight:bold; 487 | font-size: 20px; 488 | float: left; 489 | margin-left: 20px; 490 | position: relative; 491 | left: 199px; 492 | top: -100px; 493 | } 494 | #contentprice{ 495 | font-family: math; 496 | color: red; 497 | font-weight:bold; 498 | font-size: 20px; 499 | float: right; 500 | margin-right: 20px; 501 | position: relative; 502 | top: -130px; 503 | right: 100px; 504 | } 505 | #contentdescribe{ 506 | width: 452px; 507 | font-family:'PingHei','Helvetica Neue','Helvetica','Arial','Verdana','sans-serif'; 508 | font-size: 10px; 509 | font-weight: bold; 510 | color: black; 511 | } 512 | #amount{ 513 | font-family:'PingHei','Helvetica Neue','Helvetica','Arial','Verdana','sans-serif'; 514 | font-size: 15px; 515 | font-weight: bold; 516 | color: black; 517 | } 518 | .all_price{ 519 | float: right; 520 | margin-right: 47px; 521 | } 522 | #allpriceleft{ 523 | font-family:'PingHei','Helvetica Neue','Helvetica','Arial','Verdana','sans-serif'; 524 | font-size: 34px; 525 | font-weight: bold; 526 | color: black; 527 | } 528 | #allpriceright{ 529 | font-family:'PingHei','Helvetica Neue','Helvetica','Arial','Verdana','sans-serif'; 530 | font-size: 34px; 531 | font-weight: bold; 532 | color: black; 533 | } 534 | #allpricebotton{ 535 | width: 270px; /* 宽度 */ 536 | height: 40px; /* 高度 */ 537 | border-width: 0px; /* 边框宽度 */ 538 | border-radius: 3px; /* 边框半径 */ 539 | background: #1E90FF; /* 背景颜色 */ 540 | cursor: pointer; /* 鼠标移入按钮范围时出现手势 */ 541 | outline: none; /* 不显示轮廓线 */ 542 | font-family: Microsoft YaHei; /* 设置字体 */ 543 | color: white; /* 字体颜色 */ 544 | font-size: 17px; 545 | margin: 10px; 546 | margin-left: 95px; 547 | } 548 | #allpricebotton:hover{ 549 | background: #5599FF; 550 | } -------------------------------------------------------------------------------- /src/main/webapp/error.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8"%> 3 | 4 | 5 | 6 | 7 | Insert title here 8 | 9 | 10 |

请登录后再访问该页面!

11 | 返回 12 | 13 | -------------------------------------------------------------------------------- /src/main/webapp/images/buy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OliverLoki/javaWeb_sportsStore/b2452e76ec432fe0e927b346a389156a08ca358d/src/main/webapp/images/buy.png -------------------------------------------------------------------------------- /src/main/webapp/images/clock.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OliverLoki/javaWeb_sportsStore/b2452e76ec432fe0e927b346a389156a08ca358d/src/main/webapp/images/clock.jpg -------------------------------------------------------------------------------- /src/main/webapp/images/formBg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OliverLoki/javaWeb_sportsStore/b2452e76ec432fe0e927b346a389156a08ca358d/src/main/webapp/images/formBg.png -------------------------------------------------------------------------------- /src/main/webapp/images/gys.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OliverLoki/javaWeb_sportsStore/b2452e76ec432fe0e927b346a389156a08ca358d/src/main/webapp/images/gys.png -------------------------------------------------------------------------------- /src/main/webapp/images/home.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OliverLoki/javaWeb_sportsStore/b2452e76ec432fe0e927b346a389156a08ca358d/src/main/webapp/images/home.png -------------------------------------------------------------------------------- /src/main/webapp/images/leftBg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OliverLoki/javaWeb_sportsStore/b2452e76ec432fe0e927b346a389156a08ca358d/src/main/webapp/images/leftBg.png -------------------------------------------------------------------------------- /src/main/webapp/images/loginBg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OliverLoki/javaWeb_sportsStore/b2452e76ec432fe0e927b346a389156a08ca358d/src/main/webapp/images/loginBg.jpg -------------------------------------------------------------------------------- /src/main/webapp/images/login_bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OliverLoki/javaWeb_sportsStore/b2452e76ec432fe0e927b346a389156a08ca358d/src/main/webapp/images/login_bg.jpg -------------------------------------------------------------------------------- /src/main/webapp/images/login_img.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OliverLoki/javaWeb_sportsStore/b2452e76ec432fe0e927b346a389156a08ca358d/src/main/webapp/images/login_img.png -------------------------------------------------------------------------------- /src/main/webapp/images/mm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OliverLoki/javaWeb_sportsStore/b2452e76ec432fe0e927b346a389156a08ca358d/src/main/webapp/images/mm.png -------------------------------------------------------------------------------- /src/main/webapp/images/n.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OliverLoki/javaWeb_sportsStore/b2452e76ec432fe0e927b346a389156a08ca358d/src/main/webapp/images/n.png -------------------------------------------------------------------------------- /src/main/webapp/images/read.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OliverLoki/javaWeb_sportsStore/b2452e76ec432fe0e927b346a389156a08ca358d/src/main/webapp/images/read.png -------------------------------------------------------------------------------- /src/main/webapp/images/schu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OliverLoki/javaWeb_sportsStore/b2452e76ec432fe0e927b346a389156a08ca358d/src/main/webapp/images/schu.png -------------------------------------------------------------------------------- /src/main/webapp/images/search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OliverLoki/javaWeb_sportsStore/b2452e76ec432fe0e927b346a389156a08ca358d/src/main/webapp/images/search.png -------------------------------------------------------------------------------- /src/main/webapp/images/tc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OliverLoki/javaWeb_sportsStore/b2452e76ec432fe0e927b346a389156a08ca358d/src/main/webapp/images/tc.png -------------------------------------------------------------------------------- /src/main/webapp/images/tianjia.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OliverLoki/javaWeb_sportsStore/b2452e76ec432fe0e927b346a389156a08ca358d/src/main/webapp/images/tianjia.png -------------------------------------------------------------------------------- /src/main/webapp/images/time.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OliverLoki/javaWeb_sportsStore/b2452e76ec432fe0e927b346a389156a08ca358d/src/main/webapp/images/time.png -------------------------------------------------------------------------------- /src/main/webapp/images/xiugai.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OliverLoki/javaWeb_sportsStore/b2452e76ec432fe0e927b346a389156a08ca358d/src/main/webapp/images/xiugai.png -------------------------------------------------------------------------------- /src/main/webapp/images/y.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OliverLoki/javaWeb_sportsStore/b2452e76ec432fe0e927b346a389156a08ca358d/src/main/webapp/images/y.png -------------------------------------------------------------------------------- /src/main/webapp/images/yh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OliverLoki/javaWeb_sportsStore/b2452e76ec432fe0e927b346a389156a08ca358d/src/main/webapp/images/yh.png -------------------------------------------------------------------------------- /src/main/webapp/images/zd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OliverLoki/javaWeb_sportsStore/b2452e76ec432fe0e927b346a389156a08ca358d/src/main/webapp/images/zd.png -------------------------------------------------------------------------------- /src/main/webapp/jsp/buygoods.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %> 2 | <%@include file="/jsp/common/head.jsp" %> 3 |
4 |
5 | 你现在所在的位置是: 6 | 商品详情页 7 |
8 |
9 |
10 |
11 | 12 |
13 |
14 |
15 |

购买   ${goodsinfo.gname}

18 |
19 |
20 |
21 |
22 | ${goodsinfo.gdesc} 23 |
24 |







25 |
26 | RMB 27 |   28 | ${goodsinfo.gprice} 29 |
30 | 31 |
32 | <%-- --%> 33 | 立即购买 34 | 35 | 加入购物车 36 | 37 |


38 | 返回商品展示页 39 |
40 | 41 |
42 |
43 |
44 |
45 | 46 | 47 | 71 | 72 | 73 | <%@include file="/jsp/common/foot.jsp" %> 74 | -------------------------------------------------------------------------------- /src/main/webapp/jsp/common/foot.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8"%> 3 | 4 | 5 | 6 |
7 | 运动产品管理系统 8 |
9 | 10 | -------------------------------------------------------------------------------- /src/main/webapp/jsp/common/head.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8"%> 3 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 4 | <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %> 5 | 6 | 7 | 8 | 9 | 运动产品订购系统 10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 |

运动产品订购系统

18 |
19 |

下午好! ${userSession.uname} , 欢迎你!

20 | 退出 21 |
22 |
23 | 24 |
25 |
26 |

功能列表

27 | 36 |
37 | 38 | "/> -------------------------------------------------------------------------------- /src/main/webapp/jsp/error.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8"%> 3 | 4 | 5 | 6 | 7 | Insert title here 8 | 9 | 10 | 你要访问的页面,已经飞往火星! 11 | 返回 12 | 13 | -------------------------------------------------------------------------------- /src/main/webapp/jsp/frame.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> 2 | <%@include file="/jsp/common/head.jsp"%> 3 |
4 |
5 |

${userSession.uname}

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 | <%@include file="/jsp/common/foot.jsp" %> 32 | -------------------------------------------------------------------------------- /src/main/webapp/jsp/goodsshow.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %> 2 | <%@include file="/jsp/common/head.jsp" %> 3 |
4 |
5 | 你现在所在的位置是: 6 | 商品展示界面 7 |
8 | 28 |
29 |
30 | 31 |
32 |
33 | 35 |
36 |
37 | ${goods.gname} 38 |
39 |
40 | ¥${goods.gprice} 41 |
42 |
43 |
44 |
45 |
46 |
47 | 48 | 49 | -------------------------------------------------------------------------------- /src/main/webapp/jsp/pwdmodify.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8"%> 3 | <%@include file="/jsp/common/head.jsp"%> 4 |
5 |
6 | 你现在所在的位置是: 7 | 密码修改页面 8 |
9 |
10 |
11 | 12 | 13 |
${message}
14 |
15 | 16 | 17 | 18 |
19 |
20 | 21 | 22 | 23 |
24 |
25 | 26 | 27 | 28 |
29 |
30 | 31 | 32 |
33 |
34 |
35 |
36 | 37 | <%@include file="/jsp/common/foot.jsp" %> 38 | -------------------------------------------------------------------------------- /src/main/webapp/jsp/shoppingcart.jsp: -------------------------------------------------------------------------------- 1 | <%@ page import="smbms.pojo.Goods" %> 2 | <%@ page import="java.util.List" %> 3 | <%@ page import="smbms.tools.Constants" %> 4 | <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> 5 | <%@include file="/jsp/common/head.jsp"%> 6 |
7 |
8 | 你现在所在的位置是: 9 | 购物车结算界面 10 |
11 | <% 12 | float sum = 0; 13 | for(Goods goods:(List)(request.getAttribute(Constants.CARTGOODS))){ 14 | sum+=Float.parseFloat(goods.getGprice()); 15 | } 16 | %> 17 |
18 | 19 |
20 |
21 | 22 |
23 |
24 | ${goods.gname} 25 |
数量:   1
26 | ${goods.gdesc} 27 | ¥${goods.gprice} 28 | 29 |
30 |
31 |
32 |
33 | 34 |
35 | 当前商品总价为 :   36 | <%=sum%> 37 |
38 | 39 |
40 |
41 | 42 | 43 | <%@include file="/jsp/common/foot.jsp" %> 44 | -------------------------------------------------------------------------------- /src/main/webapp/jsp/usershow.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> 2 | <%@include file="/jsp/common/head.jsp"%> 3 |
4 |
5 | 你现在所在的位置是: 6 | 用户信息界面 7 |
8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 |
用户id登录账号登录密码用户姓名
${user.uid}${user.username}${user.pwd}${user.uname}
25 | 26 | 27 | 28 |
29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 |
39 | 40 | 41 | <%@include file="/jsp/common/foot.jsp" %> 42 | -------------------------------------------------------------------------------- /src/main/webapp/login.jsp: -------------------------------------------------------------------------------- 1 | <%@ page import="smbms.tools.Constants" %> 2 | <%@ page language="java" contentType="text/html; charset=UTF-8" 3 | pageEncoding="UTF-8"%> 4 | <%@ page isELIgnored="false" %> 5 | 6 | 7 | 8 | 运动产品订购系统 9 | 10 | 11 | 12 |
13 |
14 |

运动产品订购系统

15 |
16 |
17 |
18 |
19 | <%-- 这里只能用键值对的键进行查询 --%> 20 | ${error} 21 |
22 |
23 | 24 | 25 |
26 |
27 | 28 | 29 |
30 |
31 | 32 | 注册 33 |
34 |
35 | 36 |
37 |
38 | 39 | 40 | -------------------------------------------------------------------------------- /src/main/webapp/register.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> 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 | 40 |
41 |
42 | 43 | 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 | --------------------------------------------------------------------------------