目錄
一、系統介紹
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.
