主頁 > 後端開發 > IDEA+Java+Servlet+JSP+Mysql實作Web停車場管理系統【建議收藏】

IDEA+Java+Servlet+JSP+Mysql實作Web停車場管理系統【建議收藏】

2021-08-16 10:45:47 後端開發

目錄

一、系統介紹

1.開發環境

2.技術選型

3.系統功能

4.資料庫

5.工程截圖

二、系統展示

1.登錄界面

2.主頁面

3.系統資訊管理-添加角色資訊

4.系統資訊管理-管理角色資訊

5.系統資訊管理-添加用戶資訊

6.系統資訊管理-管理用戶資訊

7.車位資訊管理-添加車位資訊

8.車位資訊管理-管理車位資訊

9.IC卡資訊管理-添加IC卡型別

10.IC卡資訊管理-管理IC卡型別

11.固定車主停車管理-出入場設定

12.固定車主停車管理-停車資訊管理

13.臨時車輛停車管理-車主入場資訊

14.臨時車輛停車管理-車主出場資訊

15.系統功能操作-修改密碼

三、部分代碼

CardHandle

FixedHandle

LoginHandle

RoleHandle

SeatHandle

UserHandle

四、其他

1.其他系統實作

1.JavaWeb系統系列實作

2.JavaSwing系統系列實作

2.獲取原始碼

3.運行專案

4.備注

5.支持博主

6.雞湯


JavaWeb系統系列實作

Java+JSP實作學生圖書管理系統

Java+JSP實作學生資訊管理系統

Java+JSP實作用戶資訊管理系統

Java+Servlet+JSP實作航空訂票系統

Java+Servlet+JSP實作新聞發布系統

Java+Servlet+JSP學生宿舍管理系統

Java+Servlet+JSP實作學生資訊管理系統

Java+Servlet+JSP實作學生選課管理系統

Java+Servlet+JSP實作學生成績管理系統-1

Java+Servlet+JSP實作學生成績管理系統-2

Java+Servlet+JSP實作寵物診所管理系統

Java+SSM+JSP實作網上考試系統

Java+SSH+JSP實作在線考試系統

Java+Springboot+Mybatis+Bootstrap+Maven實作網上商城系統

一、系統介紹

該系統包含資料庫,論文,任務書,開題報告,請在下載原始碼中下載!!!

走過路過不要錯過,點贊加關注的脫單暴富,走上人生巔峰!!!


1.開發環境

開發工具:IDEA2018.2

JDK版本:jdk1.8

Mysql版本:8.0.13

2.技術選型

后端:Java+Servlet進行開發,

前端:JSP+HTML+CSS,

3.系統功能

基于Web停車場管理系統主要用于實作停車場相關資訊管理,基本功能包括:系統資訊管理模塊、車位資訊管理模塊、IC卡資訊管理模塊、固定車主停車管理模塊、臨時車輛資訊管理模塊、系統功能操模塊等,本系統結構如下:
(1)系統資訊管理模塊:角色的增加、洗掉、修改和查詢;用戶的增加、洗掉、修改和查詢,
(2)車位資訊管理模塊:車位資訊的增加、洗掉、修改和查詢,
(3)IC卡資訊管理模塊:IC卡資訊的增加、洗掉、修改和查詢,
(4)固定車主停車管理模塊:對固定車主的停車資訊進行增加、洗掉、修改和查詢
(5)臨時車輛資訊管理模塊:對臨時車輛的停車資訊進行增加、洗掉、修改、查詢和列印
(6)系統功能操模塊:退出登陸、修改密碼,

4.資料庫

/*
 Navicat Premium Data Transfer

 Source Server         : MySQL
 Source Server Type    : MySQL
 Source Server Version : 80013
 Source Host           : 127.0.0.1:3306
 Source Schema         : servlet_parking

 Target Server Type    : MySQL
 Target Server Version : 80013
 File Encoding         : 65001

 Date: 12/08/2021 20:37:52
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for card
-- ----------------------------
DROP TABLE IF EXISTS `card`;
CREATE TABLE `card`  (
  `card_id` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  `seat_id` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  `user_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  `user_gender` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  `user_addr` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  `car_num` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  PRIMARY KEY (`card_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of card
-- ----------------------------
INSERT INTO `card` VALUES ('20150521190631', '20150521182303', '李小龍', '男', '香語區A棟3-105', '川A12345');
INSERT INTO `card` VALUES ('20150521192828', '20150521182304', '黎明', '男', '香語區A棟3-106', '川A12346');
INSERT INTO `card` VALUES ('20150521192854', '20150521182305', '王林', '女', '香語區A棟3-107', '川A12348');
INSERT INTO `card` VALUES ('20150521192915', '20150521182306', '龍飛', '男', '香語區A棟3-108', '川A12349');

-- ----------------------------
-- Table structure for fixed
-- ----------------------------
DROP TABLE IF EXISTS `fixed`;
CREATE TABLE `fixed`  (
  `fixed_id` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  `card_id` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  `entry_date` date NOT NULL,
  `entry_time` time(0) NOT NULL,
  `out_date` date NULL DEFAULT NULL,
  `out_time` time(0) NULL DEFAULT NULL,
  PRIMARY KEY (`fixed_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of fixed
-- ----------------------------
INSERT INTO `fixed` VALUES ('20150522104145', '20150521192915', '2015-05-22', '10:41:45', '2015-09-25', '10:23:34');
INSERT INTO `fixed` VALUES ('20150925102400', '20150521192828', '2015-09-25', '10:24:00', '2015-09-25', '10:24:07');
INSERT INTO `fixed` VALUES ('20150925104659', '20150521192854', '2015-09-25', '10:46:59', '2015-09-25', '17:29:04');
INSERT INTO `fixed` VALUES ('20150925180626', '20150521190631', '2015-09-25', '18:06:26', '2015-12-01', '19:04:56');
INSERT INTO `fixed` VALUES ('20210812203257', '20150521190631', '2021-08-12', '20:32:57', '2021-08-12', '20:33:30');
INSERT INTO `fixed` VALUES ('20210812203323', '20150521190631', '2021-08-12', '20:33:23', '2021-08-12', '20:33:38');

-- ----------------------------
-- Table structure for role
-- ----------------------------
DROP TABLE IF EXISTS `role`;
CREATE TABLE `role`  (
  `role_id` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  `role_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  PRIMARY KEY (`role_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of role
-- ----------------------------
INSERT INTO `role` VALUES ('r001', '超級管理員');
INSERT INTO `role` VALUES ('r002', '普通管理員');

-- ----------------------------
-- Table structure for seat
-- ----------------------------
DROP TABLE IF EXISTS `seat`;
CREATE TABLE `seat`  (
  `seat_id` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  `seat_num` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  `seat_section` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  `seat_state` int(11) NOT NULL,
  `seat_tag` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
  PRIMARY KEY (`seat_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of seat
-- ----------------------------
INSERT INTO `seat` VALUES ('20150521182303', 'A1001', 'A區', 1, '固定車主車位');
INSERT INTO `seat` VALUES ('20150521182304', 'A1002', 'A區', 1, '固定車主車位');
INSERT INTO `seat` VALUES ('20150521182305', 'A1003', 'A區', 1, '固定車主車位');
INSERT INTO `seat` VALUES ('20150521182306', 'A1004', 'A區', 1, '固定車主車位');
INSERT INTO `seat` VALUES ('20150521182307', 'A1005', 'A區', 1, '固定車主車位');
INSERT INTO `seat` VALUES ('20150521182308', 'A1006', 'A區', 0, '固定車主車位');
INSERT INTO `seat` VALUES ('20150521182309', 'A1007', 'A區', 0, '固定車主車位');
INSERT INTO `seat` VALUES ('20150521182310', 'A1008', 'A區', 0, '固定車主車位');
INSERT INTO `seat` VALUES ('20150521182311', 'VIP1001', 'B區', 0, '固定車主車位');
INSERT INTO `seat` VALUES ('20150521182312', 'VIP1002', 'B區', 0, '固定車主車位');
INSERT INTO `seat` VALUES ('20150521182313', 'VIP1003', 'B區', 0, '固定車主車位');
INSERT INTO `seat` VALUES ('20150521182314', 'VIP1004', 'B區', 0, '固定車主車位');
INSERT INTO `seat` VALUES ('20150521182315', 'VIP1005', 'B區', 0, '固定車主車位');
INSERT INTO `seat` VALUES ('20150521182316', 'VIP1007', 'B區', 0, '固定車主車位');
INSERT INTO `seat` VALUES ('20150521182318', 'VIP10010', 'B區', 0, '固定車主車位');
INSERT INTO `seat` VALUES ('20150521182319', 'VIP10012', 'B區', 0, '固定車主車位');

-- ----------------------------
-- Table structure for temp
-- ----------------------------
DROP TABLE IF EXISTS `temp`;
CREATE TABLE `temp`  (
  `temp_id` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  `card_id` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  `car_num` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  `entry_date` date NOT NULL,
  `entry_time` time(0) NOT NULL,
  `out_date` date NULL DEFAULT NULL,
  `out_time` time(0) NULL DEFAULT NULL,
  `temp_money` float NULL DEFAULT NULL,
  PRIMARY KEY (`temp_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of temp
-- ----------------------------
INSERT INTO `temp` VALUES ('20150925173007', '川B23333', '川B23333', '2015-09-25', '17:30:07', '2015-11-28', '21:29:26', 20);
INSERT INTO `temp` VALUES ('20150925203021', '川B23333', '川B23333', '2015-09-25', '20:30:21', '2015-11-28', '21:29:26', 15);
INSERT INTO `temp` VALUES ('20151201190239', '川B11111', '川B11111', '2015-12-01', '19:02:39', '2015-12-01', '19:04:24', 3);
INSERT INTO `temp` VALUES ('20151201190418', '川F22222', '川F22222', '2015-12-01', '19:04:18', '2015-12-01', '19:04:28', 3);

-- ----------------------------
-- Table structure for user
-- ----------------------------
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user`  (
  `user_id` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  `role_id` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  `user_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  `real_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  `user_pwd` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  `user_phone` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
  PRIMARY KEY (`user_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of user
-- ----------------------------
INSERT INTO `user` VALUES ('admin_01', 'r002', 'Lulu', '魯露', '123456', '13900000002');
INSERT INTO `user` VALUES ('admin_02', 'r002', 'Ilin', '依琳', '123456', '13900000003');
INSERT INTO `user` VALUES ('SAdmin', 'r001', 'Jimi', '吉米', '123456', '13900000001');

-- ----------------------------
-- View structure for v_card
-- ----------------------------
DROP VIEW IF EXISTS `v_card`;
CREATE ALGORITHM = UNDEFINED SQL SECURITY DEFINER VIEW `v_card` AS select `card`.`card_id` AS `card_id`,`card`.`seat_id` AS `seat_id`,`card`.`user_name` AS `user_name`,`card`.`user_gender` AS `user_gender`,`card`.`user_addr` AS `user_addr`,`card`.`car_num` AS `car_num`,`seat`.`seat_num` AS `seat_num` from (`card` join `seat` on((`card`.`seat_id` = `seat`.`seat_id`)));

-- ----------------------------
-- View structure for v_fixed
-- ----------------------------
DROP VIEW IF EXISTS `v_fixed`;
CREATE ALGORITHM = UNDEFINED SQL SECURITY DEFINER VIEW `v_fixed` AS select `fixed`.`fixed_id` AS `fixed_id`,`fixed`.`card_id` AS `card_id`,`fixed`.`entry_date` AS `entry_date`,`fixed`.`entry_time` AS `entry_time`,`fixed`.`out_date` AS `out_date`,`fixed`.`out_time` AS `out_time`,`card`.`car_num` AS `car_num`,`card`.`user_name` AS `user_name` from (`fixed` join `card` on((`fixed`.`card_id` = `card`.`card_id`)));

-- ----------------------------
-- View structure for v_user
-- ----------------------------
DROP VIEW IF EXISTS `v_user`;
CREATE ALGORITHM = UNDEFINED SQL SECURITY DEFINER VIEW `v_user` AS select `user`.`user_id` AS `user_id`,`user`.`role_id` AS `role_id`,`user`.`user_name` AS `user_name`,`user`.`real_name` AS `real_name`,`user`.`user_pwd` AS `user_pwd`,`user`.`user_phone` AS `user_phone`,`role`.`role_name` AS `role_name` from (`user` join `role` on((`user`.`role_id` = `role`.`role_id`)));

SET FOREIGN_KEY_CHECKS = 1;

5.工程截圖

二、系統展示

1.登錄界面

2.主頁面

3.系統資訊管理-添加角色資訊

4.系統資訊管理-管理角色資訊

5.系統資訊管理-添加用戶資訊

6.系統資訊管理-管理用戶資訊

7.車位資訊管理-添加車位資訊

8.車位資訊管理-管理車位資訊

9.IC卡資訊管理-添加IC卡型別

10.IC卡資訊管理-管理IC卡型別

11.固定車主停車管理-出入場設定

12.固定車主停車管理-停車資訊管理

13.臨時車輛停車管理-車主入場資訊

14.臨時車輛停車管理-車主出場資訊

15.系統功能操作-修改密碼

三、部分代碼

CardHandle

package ServletHandle;

import java.io.IOException;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import java.text.SimpleDateFormat;
import java.util.*;

public class CardHandle extends HttpServlet {

    HttpServletRequest request;
    HttpServletResponse response;
    DAL.Card card = new DAL.Card();

    //通過表單get方式傳值 將進入doGet函式(method="get")
    public void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        this.response = response;
        this.request = request;
        int handleType = Integer.parseInt(request.getParameter("type").toString());
        switch (handleType) {
            case 1://型別1代表洗掉表中的資料
                deleteEntity();
                break;
            case 4://型別4代表獲取表中資訊
                getEntity();
                break;
            case 5://型別5代表根據查詢條件獲取表中資訊
                getEntityByWhere();
                break;
            default:
                break;
        }
    }

    //通過表單post方式傳值 將進入doPost函式(method="post")
    public void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        this.request = request;
        this.response = response;
        int handleType = Integer.parseInt(request.getParameter("type").toString());//將前臺頁面傳過來的type型別轉化成整型
        switch (handleType) {
            case 2://型別2代表更新表中的資料
                updateEntity();
                break;
            case 3://型別3代表向表中添加資料
                insertEntity();
                break;
            default:
                break;
        }
    }

    //洗掉資料操作
    private void deleteEntity() throws IOException {
        String card_id = request.getParameter("card_id");//獲取前臺通過get方式傳過來的JId
        card.deleteEntity(card_id);//執行洗掉操作
        response.sendRedirect("/Parking/CardHandle?type=4");//洗掉成功后跳轉至管理頁面
    }

    //更新資料操作
    private void updateEntity() throws UnsupportedEncodingException {
        String card_id = new String(request.getParameter("card_id").getBytes("ISO8859_1"), "UTF-8");
        String seat_id = new String(request.getParameter("seat_id").getBytes("ISO8859_1"), "UTF-8");
        String user_name = new String(request.getParameter("user_name").getBytes("ISO8859_1"), "UTF-8");
        String user_gender = new String(request.getParameter("user_gender").getBytes("ISO8859_1"), "UTF-8");
        String user_addr = new String(request.getParameter("user_addr").getBytes("ISO8859_1"), "UTF-8");
        String car_num = new String(request.getParameter("car_num").getBytes("ISO8859_1"), "UTF-8");

        if (card.updateEntity(card_id, seat_id, user_name, user_gender, user_addr, car_num) == 1) {
            try {
                response.sendRedirect("/Parking/CardHandle?type=4");//成功更新資料后跳轉至CardMsg.jsp頁面
            } catch (IOException e) {
                e.printStackTrace();//例外處理
            }
        }
    }

    //插入資料操作
    private void insertEntity() throws UnsupportedEncodingException, IOException {
        response.setCharacterEncoding("UTF-8");
        response.setContentType("text/html;charset=UTF-8");
        PrintWriter out = response.getWriter();

        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
        String card_id = dateFormat.format(new Date());
        String seat_id = new String(request.getParameter("seat_id").getBytes("ISO8859_1"), "UTF-8");
        String user_name = new String(request.getParameter("user_name").getBytes("ISO8859_1"), "UTF-8");
        String user_gender = new String(request.getParameter("user_gender").getBytes("ISO8859_1"), "UTF-8");
        String user_addr = new String(request.getParameter("user_addr").getBytes("ISO8859_1"), "UTF-8");
        String car_num = new String(request.getParameter("car_num").getBytes("ISO8859_1"), "UTF-8");

        if (!card.checkExist(card_id)) {
            if (card.insertEntity(card_id, seat_id, user_name, user_gender, user_addr, car_num) == 1) {
                out.write("<script>alert('資料添加成功!'); location.href = '/Parking/CardHandle?type=4';</script>");
            } else {
                out.write("<script>alert('資料添失敗!'); location.href = '/Parking/CardHandle?type=4';</script>");
            }
        } else {
            out.write("<script>alert('主鍵重復,資料添加失敗!'); location.href = '/Parking/CardHandle?type=4';</script>");
        }
    }

    //獲取物件所有資料串列
    private void getEntity() throws ServletException, IOException {
        request.setCharacterEncoding("UTF-8");
        int page = request.getParameter("page") == null ? 1 : Integer.parseInt(request.getParameter("page").toString());//獲取跳轉的頁面號
        int totalPage = Integer.parseInt(card.getPageCount().toString());//獲取分頁總數
        List<Object> list = card.getEntity(page);//獲取資料串列
        request.setAttribute("list", list);//將資料存放到request物件中,用于轉發給前臺頁面使用
        request.setAttribute("totalPage", totalPage);//將totalPage存放到request物件中,用于轉發給前臺頁面使用
        request.getRequestDispatcher("/Admin/CardMsg.jsp").forward(request, response);//請求轉發
    }

    //根據查詢條件獲取物件所有資料串列
    private void getEntityByWhere() throws ServletException, IOException {
        request.setCharacterEncoding("UTF-8");
        String condition = request.getParameter("condition");//獲取查詢欄位的名稱
        //String value=new String(request.getParameter("value").getBytes("ISO8859_1"),"UTF-8");//獲取查詢的值
        String value = request.getParameter("value");
        String where = condition + "=\"" + value + "\"";//拼接查詢字串
        int page = request.getParameter("page") == null ? 1 : Integer.parseInt(request.getParameter("page"));//獲取要跳轉的頁面號
        int wherePage = Integer.parseInt(card.getPageCountByWhere(where).toString());//獲取查詢后的分頁總數
        List<Object> list = card.getEntityByWhere(where, page);//獲取查詢后的資料串列
        request.setAttribute("list", list);//將資料存放到request物件中,用于轉發給前臺頁面使用
        request.setAttribute("wherePage", wherePage);
        request.setAttribute("condition", condition);
        request.setAttribute("value", value);
        request.getRequestDispatcher("/Admin/CardMsg.jsp").forward(request, response);
    }
}

FixedHandle

package ServletHandle;

import java.io.IOException;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import java.text.SimpleDateFormat;
import java.util.*;

public class FixedHandle extends HttpServlet {

    HttpServletRequest request;
    HttpServletResponse response;
    DAL.Fixed fixed = new DAL.Fixed();

    //通過表單get方式傳值 將進入doGet函式(method="get")
    public void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        this.response = response;
        this.request = request;
        int handleType = Integer.parseInt(request.getParameter("type").toString());
        switch (handleType) {
            case 1://型別1代表洗掉表中的資料
                deleteEntity();
                break;
            case 4://型別4代表獲取表中資訊
                getEntity();
                break;
            case 5://型別5代表根據查詢條件獲取表中資訊
                getEntityByWhere();
                break;
            case 6://型別6代表管理員獲取未出場車輛
                getNoOut();
                break;
            case 10://型別10代表更新車輛出場
                setOut();
                break;
            default:
                break;
        }
    }

    //通過表單post方式傳值 將進入doPost函式(method="post")
    public void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        this.request = request;
        this.response = response;
        int handleType = Integer.parseInt(request.getParameter("type").toString());//將前臺頁面傳過來的type型別轉化成整型
        switch (handleType) {
            case 2://型別2代表更新表中的資料
                updateEntity();
                break;
            case 3://型別3代表向表中添加資料
                insertEntity();
                break;
            default:
                break;
        }
    }

    //洗掉資料操作
    private void deleteEntity() throws IOException {
        String fixed_id = request.getParameter("fixed_id");//獲取前臺通過get方式傳過來的JId
        fixed.deleteEntity(fixed_id);//執行洗掉操作
        response.sendRedirect("/Parking/FixedHandle?type=4");//洗掉成功后跳轉至管理頁面
    }

    //車輛出場更新操作
    private void setOut() throws IOException {
        String fixed_id = new String(request.getParameter("fixed_id").getBytes("ISO8859_1"), "UTF-8");
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
        String out_date = dateFormat.format(new Date());
        SimpleDateFormat timeFormat = new SimpleDateFormat("HH:mm:ss");
        String out_time = timeFormat.format(new Date());
        if (fixed.setOut(fixed_id, out_date, out_time) == 1) {
            response.sendRedirect("/Parking/FixedHandle?type=6");
        }
    }

    //更新資料操作
    private void updateEntity() throws UnsupportedEncodingException {
        String fixed_id = new String(request.getParameter("fixed_id").getBytes("ISO8859_1"), "UTF-8");
        String card_id = new String(request.getParameter("card_id").getBytes("ISO8859_1"), "UTF-8");
        String entry_date = new String(request.getParameter("entry_date").getBytes("ISO8859_1"), "UTF-8");
        String entry_time = new String(request.getParameter("entry_time").getBytes("ISO8859_1"), "UTF-8");
        String out_date = new String(request.getParameter("out_date").getBytes("ISO8859_1"), "UTF-8");
        String out_time = new String(request.getParameter("out_time").getBytes("ISO8859_1"), "UTF-8");

        if (fixed.updateEntity(fixed_id, card_id, entry_date, entry_time, out_date, out_time) == 1) {
            try {
                response.sendRedirect("/Parking/FixedHandle?type=4");//成功更新資料后跳轉至FixedMsg.jsp頁面
            } catch (IOException e) {
                e.printStackTrace();//例外處理
            }
        }
    }

    //插入資料操作
    private void insertEntity() throws UnsupportedEncodingException, IOException {
        response.setCharacterEncoding("UTF-8");
        response.setContentType("text/html;charset=UTF-8");
        PrintWriter out = response.getWriter();

        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
        String fixed_id = dateFormat.format(new Date());
        String card_id = new String(request.getParameter("card_id").getBytes("ISO8859_1"), "UTF-8");
        SimpleDateFormat dFormat = new SimpleDateFormat("yyyy-MM-dd");
        String entry_date = dFormat.format(new Date());
        SimpleDateFormat tFormat = new SimpleDateFormat("HH:mm:ss");
        String entry_time = tFormat.format(new Date());
        String out_date = "1111-11-11";
        String out_time = "11:11:11";

        if (!fixed.checkExist(fixed_id)) {
            if (fixed.insertEntity(fixed_id, card_id, entry_date, entry_time, out_date, out_time) == 1) {
                out.write("<script>alert('資料添加成功!'); location.href = '/Parking/FixedHandle?type=6';</script>");
            } else {
                out.write("<script>alert('資料添失敗!'); location.href = '/Parking/FixedHandle?type=6';</script>");
            }
        } else {
            out.write("<script>alert('主鍵重復,資料添加失敗!'); location.href = '/Parking/FixedHandle?type=4';</script>");
        }
    }

    //獲取物件所有資料串列
    private void getEntity() throws ServletException, IOException {
        request.setCharacterEncoding("UTF-8");
        int page = request.getParameter("page") == null ? 1 : Integer.parseInt(request.getParameter("page").toString());//獲取跳轉的頁面號
        int totalPage = Integer.parseInt(fixed.getPageCount().toString());//獲取分頁總數
        List<Object> list = fixed.getEntity(page);//獲取資料串列
        request.setAttribute("list", list);//將資料存放到request物件中,用于轉發給前臺頁面使用
        request.setAttribute("totalPage", totalPage);//將totalPage存放到request物件中,用于轉發給前臺頁面使用
        request.getRequestDispatcher("/Admin/FixedMsg.jsp").forward(request, response);//請求轉發
    }

    //獲取未出場的車輛
    private void getNoOut() throws ServletException, IOException {
        request.setCharacterEncoding("UTF-8");
        int page = request.getParameter("page") == null ? 1 : Integer.parseInt(request.getParameter("page").toString());//獲取跳轉的頁面號
        int totalPage = Integer.parseInt(fixed.getPageCount().toString());//獲取分頁總數
        List<Object> list = fixed.getNoOut(page);//獲取資料串列
        request.setAttribute("list", list);//將資料存放到request物件中,用于轉發給前臺頁面使用
        request.setAttribute("totalPage", totalPage);//將totalPage存放到request物件中,用于轉發給前臺頁面使用
        request.getRequestDispatcher("/Admin/FixedOut.jsp").forward(request, response);//請求轉發
    }

    //根據查詢條件獲取物件所有資料串列
    private void getEntityByWhere() throws ServletException, IOException {
        request.setCharacterEncoding("UTF-8");
        String condition = request.getParameter("condition");//獲取查詢欄位的名稱
        //String value=new String(request.getParameter("value").getBytes("ISO8859_1"),"UTF-8");//獲取查詢的值
        String value = request.getParameter("value");
        String where = condition + "=\"" + value + "\"";//拼接查詢字串
        int page = request.getParameter("page") == null ? 1 : Integer.parseInt(request.getParameter("page"));//獲取要跳轉的頁面號
        int wherePage = Integer.parseInt(fixed.getPageCountByWhere(where).toString());//獲取查詢后的分頁總數
        List<Object> list = fixed.getEntityByWhere(where, page);//獲取查詢后的資料串列
        request.setAttribute("list", list);//將資料存放到request物件中,用于轉發給前臺頁面使用
        request.setAttribute("wherePage", wherePage);
        request.setAttribute("condition", condition);
        request.setAttribute("value", value);
        request.getRequestDispatcher("/Admin/FixedMsg.jsp").forward(request, response);
    }
}

LoginHandle

package ServletHandle;


import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

public class LoginHandle extends HttpServlet {

    public void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        response.setCharacterEncoding("UTF-8");//設定輸出編碼格式
        response.setContentType("text/html;charset=UTF-8");
        HttpSession session = request.getSession();
        String user_id = request.getParameter("user_id");//獲取前臺url傳過來的uName引數
        String user_pwd = request.getParameter("user_pwd");//獲取前臺url傳過來的uPwd引數
        DAL.Login _login = new DAL.Login();//實體化Login物件,來至DAL包
        boolean result = _login.checkLogin(user_id, user_pwd);//檢查登陸用戶是否合法
        if (result)//登陸正確
        {
            session.setAttribute("user_id", user_id);//將用戶userId保存在session物件中全域使用
            String user_name = _login.getName(user_id);//獲取用戶名
            session.setAttribute("user_name", user_name);
            String role_id = _login.getSysLevel(user_id);
            session.setAttribute("role_id", role_id);
            request.getRequestDispatcher("/index.jsp").forward(request, response);

        } else {//登陸錯誤
            PrintWriter out = response.getWriter();
            out.write("<script>alert('用戶名或密碼錯誤!');location.href='Login.jsp';</script>");
        }
    }

}


RoleHandle

package ServletHandle;

import java.io.IOException;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import java.util.*;

public class RoleHandle extends HttpServlet {

    HttpServletRequest request;
    HttpServletResponse response;
    DAL.Role role = new DAL.Role();

    //通過表單get方式傳值 將進入doGet函式(method="get")
    public void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        this.response = response;
        this.request = request;
        int handleType = Integer.parseInt(request.getParameter("type").toString());
        switch (handleType) {
            case 1://型別1代表洗掉表中的資料
                deleteEntity();
                break;
            case 4://型別4代表獲取表中資訊
                getEntity();
                break;
            case 5://型別5代表根據查詢條件獲取表中資訊
                getEntityByWhere();
                break;
            default:
                break;
        }
    }

    //通過表單post方式傳值 將進入doPost函式(method="post")
    public void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        this.request = request;
        this.response = response;
        int handleType = Integer.parseInt(request.getParameter("type").toString());//將前臺頁面傳過來的type型別轉化成整型
        switch (handleType) {
            case 2://型別2代表更新表中的資料
                updateEntity();
                break;
            case 3://型別3代表向表中添加資料
                insertEntity();
                break;
            default:
                break;
        }
    }

    //洗掉資料操作
    private void deleteEntity() throws IOException {
        String role_id = request.getParameter("role_id");//獲取前臺通過get方式傳過來的JId
        role.deleteEntity(role_id);//執行洗掉操作
        response.sendRedirect("/Parking/RoleHandle?type=4");//洗掉成功后跳轉至管理頁面
    }

    //更新資料操作
    private void updateEntity() throws UnsupportedEncodingException {
        String role_id = new String(request.getParameter("role_id").getBytes("ISO8859_1"), "UTF-8");
        String role_name = new String(request.getParameter("role_name").getBytes("ISO8859_1"), "UTF-8");

        if (role.updateEntity(role_id, role_name) == 1) {
            try {
                response.sendRedirect("/Parking/RoleHandle?type=4");//成功更新資料后跳轉至RoleMsg.jsp頁面
            } catch (IOException e) {
                e.printStackTrace();//例外處理
            }
        }
    }

    //插入資料操作
    private void insertEntity() throws UnsupportedEncodingException, IOException {
        response.setCharacterEncoding("UTF-8");
        response.setContentType("text/html;charset=UTF-8");
        PrintWriter out = response.getWriter();

        String role_id = new String(request.getParameter("role_id").getBytes("ISO8859_1"), "UTF-8");
        String role_name = new String(request.getParameter("role_name").getBytes("ISO8859_1"), "UTF-8");

        if (!role.checkExist(role_id)) {
            if (role.insertEntity(role_id, role_name) == 1) {
                out.write("<script>alert('資料添加成功!'); location.href = '/Parking/RoleHandle?type=4';</script>");
            } else {
                out.write("<script>alert('資料添失敗!'); location.href = '/Parking/RoleHandle?type=4';</script>");
            }
        } else {
            out.write("<script>alert('主鍵重復,資料添加失敗!'); location.href = '/Parking/RoleHandle?type=4';</script>");
        }
    }

    //獲取物件所有資料串列
    private void getEntity() throws ServletException, IOException {
        request.setCharacterEncoding("UTF-8");
        int page = request.getParameter("page") == null ? 1 : Integer.parseInt(request.getParameter("page").toString());//獲取跳轉的頁面號
        int totalPage = Integer.parseInt(role.getPageCount().toString());//獲取分頁總數
        List<Object> list = role.getEntity(page);//獲取資料串列
        request.setAttribute("list", list);//將資料存放到request物件中,用于轉發給前臺頁面使用
        request.setAttribute("totalPage", totalPage);//將totalPage存放到request物件中,用于轉發給前臺頁面使用
        request.getRequestDispatcher("/Admin/RoleMsg.jsp").forward(request, response);//請求轉發
    }

    //根據查詢條件獲取物件所有資料串列
    private void getEntityByWhere() throws ServletException, IOException {
        request.setCharacterEncoding("UTF-8");
        String condition = request.getParameter("condition");//獲取查詢欄位的名稱
        System.out.println(condition);
        //String value=new String(request.getParameter("value").getBytes("ISO8859_1"),"UTF-8");//獲取查詢的值
        String value = request.getParameter("value");
        System.out.println("value  " + value);
        String where = condition + "=\"" + value + "\"";//拼接查詢字串
        System.out.println("where  " + where);
        int page = request.getParameter("page") == null ? 1 : Integer.parseInt(request.getParameter("page"));//獲取要跳轉的頁面號
        //System.out.println("page +"+page );
        int wherePage = Integer.parseInt(role.getPageCountByWhere(where).toString());//獲取查詢后的分頁總數
        List<Object> list = role.getEntityByWhere(where, page);//獲取查詢后的資料串列
        System.out.println();
        request.setAttribute("list", list);//將資料存放到request物件中,用于轉發給前臺頁面使用
        request.setAttribute("wherePage", wherePage);
        request.setAttribute("condition", condition);
        request.setAttribute("value", value);
        request.getRequestDispatcher("/Admin/RoleMsg.jsp").forward(request, response);
    }
}


SeatHandle

package ServletHandle;

import java.io.IOException;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import java.text.SimpleDateFormat;
import java.util.*;

public class SeatHandle extends HttpServlet {

    HttpServletRequest request;
    HttpServletResponse response;
    DAL.Seat seat = new DAL.Seat();

    //通過表單get方式傳值 將進入doGet函式(method="get")
    public void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        this.response = response;
        this.request = request;
        int handleType = Integer.parseInt(request.getParameter("type").toString());
        switch (handleType) {
            case 1://型別1代表洗掉表中的資料
                deleteEntity();
                break;
            case 4://型別4代表獲取表中資訊
                getEntity();
                break;
            case 5://型別5代表根據查詢條件獲取表中資訊
                getEntityByWhere();
                break;
            default:
                break;
        }
    }

    //通過表單post方式傳值 將進入doPost函式(method="post")
    public void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        this.request = request;
        this.response = response;
        int handleType = Integer.parseInt(request.getParameter("type").toString());//將前臺頁面傳過來的type型別轉化成整型
        switch (handleType) {
            case 2://型別2代表更新表中的資料
                updateEntity();
                break;
            case 3://型別3代表向表中添加資料
                insertEntity();
                break;
            default:
                break;
        }
    }

    //洗掉資料操作
    private void deleteEntity() throws IOException {
        String seat_id = request.getParameter("seat_id");//獲取前臺通過get方式傳過來的JId
        seat.deleteEntity(seat_id);//執行洗掉操作
        response.sendRedirect("/Parking/SeatHandle?type=4");//洗掉成功后跳轉至管理頁面
    }

    //更新資料操作
    private void updateEntity() throws UnsupportedEncodingException {
        String seat_id = new String(request.getParameter("seat_id").getBytes("ISO8859_1"), "UTF-8");
        String seat_num = new String(request.getParameter("seat_num").getBytes("ISO8859_1"), "UTF-8");
        String seat_section = new String(request.getParameter("seat_section").getBytes("ISO8859_1"), "UTF-8");
        String seat_state = new String(request.getParameter("seat_state").getBytes("ISO8859_1"), "UTF-8");
        String seat_tag = new String(request.getParameter("seat_tag").getBytes("ISO8859_1"), "UTF-8");

        if (seat.updateEntity(seat_id, seat_num, seat_section, seat_state, seat_tag) == 1) {
            try {
                response.sendRedirect("/Parking/SeatHandle?type=4");//成功更新資料后跳轉至SeatMsg.jsp頁面
            } catch (IOException e) {
                e.printStackTrace();//例外處理
            }
        }
    }

    //插入資料操作
    private void insertEntity() throws UnsupportedEncodingException, IOException {
        response.setCharacterEncoding("UTF-8");
        response.setContentType("text/html;charset=UTF-8");
        PrintWriter out = response.getWriter();

        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
        String seat_id = dateFormat.format(new Date());
        String seat_num = new String(request.getParameter("seat_num").getBytes("ISO8859_1"), "UTF-8");
        String seat_section = new String(request.getParameter("seat_section").getBytes("ISO8859_1"), "UTF-8");
        String seat_state = "0";
        String seat_tag = new String(request.getParameter("seat_tag").getBytes("ISO8859_1"), "UTF-8");

        if (!seat.checkExist(seat_id)) {
            if (seat.insertEntity(seat_id, seat_num, seat_section, seat_state, seat_tag) == 1) {
                out.write("<script>alert('資料添加成功!'); location.href = '/Parking/SeatHandle?type=4';</script>");
            } else {
                out.write("<script>alert('資料添失敗!'); location.href = '/Parking/SeatHandle?type=4';</script>");
            }
        } else {
            out.write("<script>alert('主鍵重復,資料添加失敗!'); location.href = '/Parking/SeatHandle?type=4';</script>");
        }
    }

    //獲取物件所有資料串列
    private void getEntity() throws ServletException, IOException {
        request.setCharacterEncoding("UTF-8");
        int page = request.getParameter("page") == null ? 1 : Integer.parseInt(request.getParameter("page").toString());//獲取跳轉的頁面號
        int totalPage = Integer.parseInt(seat.getPageCount().toString());//獲取分頁總數
        List<Object> list = seat.getEntity(page);//獲取資料串列
        request.setAttribute("list", list);//將資料存放到request物件中,用于轉發給前臺頁面使用
        request.setAttribute("totalPage", totalPage);//將totalPage存放到request物件中,用于轉發給前臺頁面使用
        request.getRequestDispatcher("/Admin/SeatMsg.jsp").forward(request, response);//請求轉發
    }

    //根據查詢條件獲取物件所有資料串列
    private void getEntityByWhere() throws ServletException, IOException {
        request.setCharacterEncoding("UTF-8");
        String condition = request.getParameter("condition");//獲取查詢欄位的名稱
        //String value=new String(request.getParameter("value").getBytes("ISO8859_1"),"UTF-8");//獲取查詢的值
        String value = request.getParameter("value");
        if (value.equals("閑置")) {
            String where = condition + "=0";
            System.out.println("where=" + where);
            int page = request.getParameter("page") == null ? 1 : Integer.parseInt(request.getParameter("page"));//獲取要跳轉的頁面號
            int wherePage = Integer.parseInt(seat.getPageCountByWhere(where).toString());//獲取查詢后的分頁總數
            List<Object> list = seat.getEntityByWhere(where, page);//獲取查詢后的資料串列
            request.setAttribute("list", list);//將資料存放到request物件中,用于轉發給前臺頁面使用
            request.setAttribute("wherePage", wherePage);
            request.setAttribute("condition", condition);
            request.setAttribute("value", value);
            request.getRequestDispatcher("/Admin/SeatMsg.jsp").forward(request, response);
        }
        if (value.equals("占用")) {
            String where = condition + "=1";
            System.out.println("where=" + where);
            int page = request.getParameter("page") == null ? 1 : Integer.parseInt(request.getParameter("page"));//獲取要跳轉的頁面號
            int wherePage = Integer.parseInt(seat.getPageCountByWhere(where).toString());//獲取查詢后的分頁總數
            List<Object> list = seat.getEntityByWhere(where, page);//獲取查詢后的資料串列
            request.setAttribute("list", list);//將資料存放到request物件中,用于轉發給前臺頁面使用
            request.setAttribute("wherePage", wherePage);
            request.setAttribute("condition", condition);
            request.setAttribute("value", value);
            request.getRequestDispatcher("/Admin/SeatMsg.jsp").forward(request, response);
        } else {
            String where = condition + "=\"" + value + "\"";//拼接查詢字串
            int page = request.getParameter("page") == null ? 1 : Integer.parseInt(request.getParameter("page"));//獲取要跳轉的頁面號
            int wherePage = Integer.parseInt(seat.getPageCountByWhere(where).toString());//獲取查詢后的分頁總數
            List<Object> list = seat.getEntityByWhere(where, page);//獲取查詢后的資料串列
            request.setAttribute("list", list);//將資料存放到request物件中,用于轉發給前臺頁面使用
            request.setAttribute("wherePage", wherePage);
            request.setAttribute("condition", condition);
            request.setAttribute("value", value);
            request.getRequestDispatcher("/Admin/SeatMsg.jsp").forward(request, response);
        }
        //String where=condition+"=\""+value+"\"";//拼接查詢字串
    }
}


UserHandle

package ServletHandle;

import java.io.IOException;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;


import java.text.SimpleDateFormat;
import java.util.*;

public class UserHandle extends HttpServlet {

    HttpServletRequest request;
    HttpServletResponse response;
    DAL.User user = new DAL.User();

    //通過表單get方式傳值 將進入doGet函式(method="get")
    public void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        this.response = response;
        this.request = request;
        int handleType = Integer.parseInt(request.getParameter("type").toString());
        switch (handleType) {
            case 1://型別1代表洗掉表中的資料
                deleteEntity();
                break;
            case 4://型別4代表獲取表中資訊
                getEntity();
                break;
            case 5://型別5代表根據查詢條件獲取表中資訊
                getEntityByWhere();
                break;
            default:
                break;
        }
    }

    //通過表單post方式傳值 將進入doPost函式(method="post")
    public void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        this.request = request;
        this.response = response;
        int handleType = Integer.parseInt(request.getParameter("type").toString());//將前臺頁面傳過來的type型別轉化成整型
        switch (handleType) {
            case 2://型別2代表更新表中的資料
                updateEntity();
                break;
            case 3://型別3代表向表中添加資料
                insertEntity();
                break;
            case 6://型別6代表向更改密碼
                chagePwd();
                break;
            case 7://型別7代表用戶更新個人資料
                updateEntity();
                break;
            case 8://用戶注冊
                register();
            default:
                break;
        }
    }

    //更改密碼
    private void chagePwd() throws IOException {
        response.setCharacterEncoding("UTF-8");
        response.setContentType("text/html;charset=UTF-8");
        PrintWriter out = response.getWriter();
        HttpSession session = request.getSession();
        String userId = session.getAttribute("user_id").toString();
        String oldPwd = new String(request.getParameter("OldPwd").getBytes("ISO8859_1"), "UTF-8");
        String newPwd = new String(request.getParameter("NewPwd").getBytes("ISO8859_1"), "UTF-8");
        if (user.checkPwd(userId, oldPwd)) {
            if (user.updataPwd(userId, newPwd)) {
                out.write("<script>alert('密碼更改成功~~~');location.href='/Parking/Common/UserInfo.jsp'</script>");
            } else {
                out.write("<script>alert('密碼更改失敗~~~');location.href='/Parking/Common/ChagePwd.jsp'</script>");
            }
        } else {
            out.write("<script>alert('原始密碼錯誤~~~');location.href='/Parking/Common/ChagePwd.jsp'</script>");
        }
    }

    //用戶注冊
    private void register() throws UnsupportedEncodingException, IOException {
        response.setCharacterEncoding("UTF-8");
        response.setContentType("text/html;charset=UTF-8");
        PrintWriter out = response.getWriter();

        String UserId = new String(request.getParameter("user_id").getBytes("ISO8859_1"), "UTF-8");
        String RoleId = new String(request.getParameter("role_id").getBytes("ISO8859_1"), "UTF-8");
        String UserName = new String(request.getParameter("user_name").getBytes("ISO8859_1"), "UTF-8");
        String RealName = new String(request.getParameter("real_name").getBytes("ISO8859_1"), "UTF-8");
        String UserPwd = new String(request.getParameter("user_pwd1").getBytes("ISO8859_1"), "UTF-8");
        String UserPhone = new String(request.getParameter("user_phone").getBytes("ISO8859_1"), "UTF-8");

        if (!user.checkExist(UserId)) {
            if (user.insertEntity(UserId, RoleId, UserName, RealName, UserPwd, UserPhone) == 1) {
                SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
                String AId = dateFormat.format(new Date());
                //Account account=new Account();
                //account.insertEntity(AId, UserId, "0","2015-12-30");
                out.write("<script>alert('恭喜你,注冊成功~'); location.href = '/Parking/Login.jsp';</script>");
            }
        } else {
            out.write("<script>alert('您注冊的登陸賬號已存在,請重新注冊!'); location.href = '/Parking/Login.jsp';</script>");
        }
    }

    //洗掉資料操作
    private void deleteEntity() throws IOException {
        String user_id = request.getParameter("user_id");//獲取前臺通過get方式傳過來的JId
        user.deleteEntity(user_id);//執行洗掉操作
        response.sendRedirect("/Parking/UserHandle?type=4");//洗掉成功后跳轉至管理頁面
    }

    //更新資料操作
    private void updateEntity() throws UnsupportedEncodingException {
        String user_id = new String(request.getParameter("user_id").getBytes("ISO8859_1"), "UTF-8");
        String role_id = new String(request.getParameter("role_id").getBytes("ISO8859_1"), "UTF-8");
        String user_name = new String(request.getParameter("user_name").getBytes("ISO8859_1"), "UTF-8");
        String real_name = new String(request.getParameter("real_name").getBytes("ISO8859_1"), "UTF-8");
        String user_pwd = new String(request.getParameter("user_pwd").getBytes("ISO8859_1"), "UTF-8");
        String user_phone = new String(request.getParameter("user_phone").getBytes("ISO8859_1"), "UTF-8");

        if (user.updateEntity(user_id, role_id, user_name, real_name, user_pwd, user_phone) == 1) {
            try {
                if (request.getSession().getAttribute("role_id").toString().equals("r001")) {
                    response.sendRedirect("/Parking/UserHandle?type=4");//成功更新資料后跳轉至UserInfo.jsp頁面
                } else {
                    response.sendRedirect("/Parking/Common/UserInfo.jsp");//成功更新資料后跳轉至UserInfo.jsp頁面
                }
            } catch (IOException e) {
                e.printStackTrace();//例外處理
            }
        }
    }

    //插入資料操作
    private void insertEntity() throws UnsupportedEncodingException, IOException {
        response.setCharacterEncoding("UTF-8");
        response.setContentType("text/html;charset=UTF-8");
        PrintWriter out = response.getWriter();

        String user_id = new String(request.getParameter("user_id").getBytes("ISO8859_1"), "UTF-8");
        String role_id = new String(request.getParameter("role_id").getBytes("ISO8859_1"), "UTF-8");
        String user_name = new String(request.getParameter("user_name").getBytes("ISO8859_1"), "UTF-8");
        String real_name = new String(request.getParameter("real_name").getBytes("ISO8859_1"), "UTF-8");
        String user_pwd = new String(request.getParameter("user_pwd").getBytes("ISO8859_1"), "UTF-8");
        String user_phone = new String(request.getParameter("user_phone").getBytes("ISO8859_1"), "UTF-8");

        if (!user.checkExist(user_id)) {
            if (user.insertEntity(user_id, role_id, user_name, real_name, user_pwd, user_phone) == 1) {
                out.write("<script>alert('資料添加成功!'); location.href = '/Parking/UserHandle?type=4';</script>");
            } else {
                out.write("<script>alert('資料添失敗!'); location.href = '/Parking/UserHandle?type=4';</script>");
            }
        } else {
            out.write("<script>alert('主鍵重復,資料添加失敗!'); location.href = '/Parking/UserHandle?type=4';</script>");
        }
    }

    //獲取物件所有資料串列
    private void getEntity() throws ServletException, IOException {
        request.setCharacterEncoding("UTF-8");
        int page = request.getParameter("page") == null ? 1 : Integer.parseInt(request.getParameter("page").toString());//獲取跳轉的頁面號
        int totalPage = Integer.parseInt(user.getPageCount().toString());//獲取分頁總數
        List<Object> list = user.getEntity(page);//獲取資料串列
        request.setAttribute("list", list);//將資料存放到request物件中,用于轉發給前臺頁面使用
        request.setAttribute("totalPage", totalPage);//將totalPage存放到request物件中,用于轉發給前臺頁面使用
        request.getRequestDispatcher("/Admin/UserMsg.jsp").forward(request, response);//請求轉發
    }

    //根據查詢條件獲取物件所有資料串列
    private void getEntityByWhere() throws ServletException, IOException {
        request.setCharacterEncoding("UTF-8");
        String condition = request.getParameter("condition");//獲取查詢欄位的名稱
        //String value=new String(request.getParameter("value").getBytes("ISO8859_1"),"UTF-8");//獲取查詢的值
        String value = request.getParameter("value");
        String where = condition + "=\"" + value + "\"";//拼接查詢字串
        int page = request.getParameter("page") == null ? 1 : Integer.parseInt(request.getParameter("page"));//獲取要跳轉的頁面號
        int wherePage = Integer.parseInt(user.getPageCountByWhere(where).toString());//獲取查詢后的分頁總數
        List<Object> list = user.getEntityByWhere(where, page);//獲取查詢后的資料串列
        request.setAttribute("list", list);//將資料存放到request物件中,用于轉發給前臺頁面使用
        request.setAttribute("wherePage", wherePage);
        request.setAttribute("condition", condition);
        request.setAttribute("value", value);
        request.getRequestDispatcher("/Admin/UserMsg.jsp").forward(request, response);
    }
}

四、其他

1.其他系統實作

1.JavaWeb系統系列實作

Java+JSP實作學生圖書管理系統

Java+JSP實作學生資訊管理系統

Java+JSP實作用戶資訊管理系統

Java+Servlet+JSP實作航空訂票系統

Java+Servlet+JSP實作新聞發布系統

Java+Servlet+JSP實作學生資訊管理系統

Java+Servlet+JSP實作學生選課管理系統

Java+Servlet+JSP實作學生成績管理系統-1

Java+Servlet+JSP實作學生成績管理系統-2

Java+Servlet+JSP實作寵物診所管理系統

Java+SSM+JSP實作網上考試系統

Java+SSH+JSP實作在線考試系統

Java+Springboot+Mybatis+Bootstrap+Maven實作網上商城系統

2.JavaSwing系統系列實作

Java+Swing實作斗地主游戲

Java+Swing實作圖書管理系統

Java+Swing實作醫院管理系統

Java+Swing實作考試管理系統

Java+Swing實作倉庫管理系統-1

Java+Swing實作倉庫管理系統-2

Java+Swing實作自助取款機系統

Java+Swing實作通訊錄管理系統

Java+Swing實作停車場管理系統

Java+Swing實作學生資訊管理系統

Java+Swing實作學生宿舍管理系統

Java+Swing實作學生選課管理系統

Java+Swing實作學生成績管理系統

Java+Swing實作學校教材管理系統

Java+Swing實作學校教務管理系統

Java+Swing實作企業人事管理系統

Java+Swing實作電子相冊管理系統

Java+Swing實作超市管理系統-TXT存盤資料

Java+Swing實作自助取款機系統-TXT存盤資料

Java+Swing實作寵物商店管理系統-TXT存盤資料

2.獲取原始碼

點擊以下鏈接獲取原始碼,資料庫檔案在sql檔案下面,論文、答辯PPT、開題報告、任務書在論文相關里面,

Java+Servlet+Jsp+Mysql實作Web停車場管理系統

3.運行專案

請點擊以下鏈接,部署你的專案,

IDEA如何匯入JavaWeb專案超詳細視頻教程

4.備注

如有侵權請聯系我洗掉,

5.支持博主

如果您覺得此文對您有幫助,請點贊加關注加收藏,祝您生活愉快!想要獲取其他資源可關注左側微信公眾號獲取!

6.雞湯

今天比昨天好就夠了!

該系統包含資料庫,論文,任務書,開題報告,請在下載原始碼中下載!!!

走過路過不要錯過,點贊加關注的脫單暴富,走上人生巔峰!!!

轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/293952.html

標籤:java

上一篇:Android的java的報錯提示:Could not find com.android.tools.build:gradle:4.2.2.

下一篇:Java集合與資料結構——優先級佇列(堆)

標籤雲
其他(157675) Python(38076) JavaScript(25376) Java(17977) C(15215) 區塊鏈(8255) C#(7972) AI(7469) 爪哇(7425) MySQL(7132) html(6777) 基礎類(6313) sql(6102) 熊猫(6058) PHP(5869) 数组(5741) R(5409) Linux(5327) 反应(5209) 腳本語言(PerlPython)(5129) 非技術區(4971) Android(4554) 数据框(4311) css(4259) 节点.js(4032) C語言(3288) json(3245) 列表(3129) 扑(3119) C++語言(3117) 安卓(2998) 打字稿(2995) VBA(2789) Java相關(2746) 疑難問題(2699) 细绳(2522) 單片機工控(2479) iOS(2429) ASP.NET(2402) MongoDB(2323) 麻木的(2285) 正则表达式(2254) 字典(2211) 循环(2198) 迅速(2185) 擅长(2169) 镖(2155) 功能(1967) .NET技术(1958) Web開發(1951) python-3.x(1918) HtmlCss(1915) 弹簧靴(1913) C++(1909) xml(1889) PostgreSQL(1872) .NETCore(1853) 谷歌表格(1846) Unity3D(1843) for循环(1842)

熱門瀏覽
  • 【C++】Microsoft C++、C 和匯編程式檔案

    ......

    uj5u.com 2020-09-10 00:57:23 more
  • 例外宣告

    相比于斷言適用于排除邏輯上不可能存在的狀態,例外通常是用于邏輯上可能發生的錯誤。 例外宣告 Item 1:當函式不可能拋出例外或不能接受拋出例外時,使用noexcept 理由 如果不打算拋出例外的話,程式就會認為無法處理這種錯誤,并且應當盡早終止,如此可以有效地阻止例外的傳播與擴散。 示例 //不可 ......

    uj5u.com 2020-09-10 00:57:27 more
  • Codeforces 1400E Clear the Multiset(貪心 + 分治)

    鏈接:https://codeforces.com/problemset/problem/1400/E 來源:Codeforces 思路:給你一個陣列,現在你可以進行兩種操作,操作1:將一段沒有 0 的區間進行減一的操作,操作2:將 i 位置上的元素歸零。最終問:將這個陣列的全部元素歸零后操作的最少 ......

    uj5u.com 2020-09-10 00:57:30 more
  • UVA11610 【Reverse Prime】

    本人看到此題沒有翻譯,就附帶了一個自己的翻譯版本 思考 這一題,它的第一個要求是找出所有 $7$ 位反向質數及其質因數的個數。 我們應該需要質數篩篩選1~$10^{7}$的所有數,這里就不慢慢介紹了。但是,重讀題,我們突然發現反向質數都是 $7$ 位,而將它反過來后的數字卻是 $6$ 位數,這就說明 ......

    uj5u.com 2020-09-10 00:57:36 more
  • 統計區間素數數量

    1 #pragma GCC optimize(2) 2 #include <bits/stdc++.h> 3 using namespace std; 4 bool isprime[1000000010]; 5 vector<int> prime; 6 inline int getlist(int ......

    uj5u.com 2020-09-10 00:57:47 more
  • C/C++編程筆記:C++中的 const 變數詳解,教你正確認識const用法

    1、C中的const 1、區域const變數存放在堆疊區中,會分配記憶體(也就是說可以通過地址間接修改變數的值)。測驗代碼如下: 運行結果: 2、全域const變數存放在只讀資料段(不能通過地址修改,會發生寫入錯誤), 默認為外部聯編,可以給其他源檔案使用(需要用extern關鍵字修飾) 運行結果: ......

    uj5u.com 2020-09-10 00:58:04 more
  • 【C++犯錯記錄】VS2019 MFC添加資源不懂如何修改資源宏ID

    1. 首先在資源視圖中,添加資源 2. 點擊新添加的資源,復制自動生成的ID 3. 在解決方案資源管理器中找到Resource.h檔案,編輯,使用整個專案搜索和替換的方式快速替換 宏宣告 4. Ctrl+Shift+F 全域搜索,點擊查找全部,然后逐個替換 5. 為什么使用搜索替換而不使用屬性視窗直 ......

    uj5u.com 2020-09-10 00:59:11 more
  • 【C++犯錯記錄】VS2019 MFC不懂的批量添加資源

    1. 打開資源頭檔案Resource.h,在其中預先定義好宏 ID(不清楚其實ID值應該設定多少,可以先新建一個相同的資源項,再在這個資源的ID值的基礎上遞增即可) 2. 在資源視圖中選中專案資源,按F7編輯資源檔案,按 ID 型別 相對路徑的形式添加 資源。(別忘了先把檔案拷貝到專案中的res檔案 ......

    uj5u.com 2020-09-10 01:00:19 more
  • C/C++編程筆記:關于C++的參考型別,專供新手入門使用

    今天要講的是C++中我最喜歡的一個用法——參考,也叫別名。 參考就是給一個變數名取一個變數名,方便我們間接地使用這個變數。我們可以給一個變數創建N個參考,這N + 1個變數共享了同一塊記憶體區域。(參考型別的變數會占用記憶體空間,占用的記憶體空間的大小和指標型別的大小是相同的。雖然參考是一個物件的別名,但 ......

    uj5u.com 2020-09-10 01:00:22 more
  • 【C/C++編程筆記】從頭開始學習C ++:初學者完整指南

    眾所周知,C ++的學習曲線陡峭,但是花時間學習這種語言將為您的職業帶來奇跡,并使您與其他開發人員區分開。您會更輕松地學習新語言,形成真正的解決問題的技能,并在編程的基礎上打下堅實的基礎。 C ++將幫助您養成良好的編程習慣(即清晰一致的編碼風格,在撰寫代碼時注釋代碼,并限制類內部的可見性),并且由 ......

    uj5u.com 2020-09-10 01:00:41 more
最新发布
  • Rust中的智能指標:Box<T> Rc<T> Arc<T> Cell<T> RefCell<T> Weak

    Rust中的智能指標是什么 智能指標(smart pointers)是一類資料結構,是擁有資料所有權和額外功能的指標。是指標的進一步發展 指標(pointer)是一個包含記憶體地址的變數的通用概念。這個地址參考,或 ” 指向”(points at)一些其 他資料 。參考以 & 符號為標志并借用了他們所 ......

    uj5u.com 2023-04-20 07:24:10 more
  • Java的值傳遞和參考傳遞

    值傳遞不會改變本身,參考傳遞(如果傳遞的值需要實體化到堆里)如果發生修改了會改變本身。 1.基本資料型別都是值傳遞 package com.example.basic; public class Test { public static void main(String[] args) { int ......

    uj5u.com 2023-04-20 07:24:04 more
  • [2]SpinalHDL教程——Scala簡單入門

    第一個 Scala 程式 shell里面輸入 $ scala scala> 1 + 1 res0: Int = 2 scala> println("Hello World!") Hello World! 檔案形式 object HelloWorld { /* 這是我的第一個 Scala 程式 * 以 ......

    uj5u.com 2023-04-20 07:23:58 more
  • 理解函式指標和回呼函式

    理解 函式指標 指向函式的指標。比如: 理解函式指標的偽代碼 void (*p)(int type, char *data); // 定義一個函式指標p void func(int type, char *data); // 宣告一個函式func p = func; // 將指標p指向函式func ......

    uj5u.com 2023-04-20 07:23:52 more
  • Django筆記二十五之資料庫函式之日期函式

    本文首發于公眾號:Hunter后端 原文鏈接:Django筆記二十五之資料庫函式之日期函式 日期函式主要介紹兩個大類,Extract() 和 Trunc() Extract() 函式作用是提取日期,比如我們可以提取一個日期欄位的年份,月份,日等資料 Trunc() 的作用則是截取,比如 2022-0 ......

    uj5u.com 2023-04-20 07:23:45 more
  • 一天吃透JVM面試八股文

    什么是JVM? JVM,全稱Java Virtual Machine(Java虛擬機),是通過在實際的計算機上仿真模擬各種計算機功能來實作的。由一套位元組碼指令集、一組暫存器、一個堆疊、一個垃圾回收堆和一個存盤方法域等組成。JVM屏蔽了與作業系統平臺相關的資訊,使得Java程式只需要生成在Java虛擬機 ......

    uj5u.com 2023-04-20 07:23:31 more
  • 使用Java接入小程式訂閱訊息!

    更新完微信服務號的模板訊息之后,我又趕緊把微信小程式的訂閱訊息給實作了!之前我一直以為微信小程式也是要企業才能申請,沒想到小程式個人就能申請。 訊息推送平臺🔥推送下發【郵件】【短信】【微信服務號】【微信小程式】【企業微信】【釘釘】等訊息型別。 https://gitee.com/zhongfuch ......

    uj5u.com 2023-04-20 07:22:59 more
  • java -- 緩沖流、轉換流、序列化流

    緩沖流 緩沖流, 也叫高效流, 按照資料型別分類: 位元組緩沖流:BufferedInputStream,BufferedOutputStream 字符緩沖流:BufferedReader,BufferedWriter 緩沖流的基本原理,是在創建流物件時,會創建一個內置的默認大小的緩沖區陣列,通過緩沖 ......

    uj5u.com 2023-04-20 07:22:49 more
  • Java-SpringBoot-Range請求頭設定實作視頻分段傳輸

    老實說,人太懶了,現在基本都不喜歡寫筆記了,但是網上有關Range請求頭的文章都太水了 下面是抄的一段StackOverflow的代碼...自己大修改過的,寫的注釋挺全的,應該直接看得懂,就不解釋了 寫的不好...只是希望能給視頻網站開發的新手一點點幫助吧. 業務場景:視頻分段傳輸、視頻多段傳輸(理 ......

    uj5u.com 2023-04-20 07:22:42 more
  • Windows 10開發教程_編程入門自學教程_菜鳥教程-免費教程分享

    教程簡介 Windows 10開發入門教程 - 從簡單的步驟了解Windows 10開發,從基本到高級概念,包括簡介,UWP,第一個應用程式,商店,XAML控制元件,資料系結,XAML性能,自適應設計,自適應UI,自適應代碼,檔案管理,SQLite資料庫,應用程式到應用程式通信,應用程式本地化,應用程式 ......

    uj5u.com 2023-04-20 07:22:35 more