作者主页:源码空间站2022
简介:Java领域优质创作者、Java项目、学习资料、技术互助
文末获取源码
本项目包含两个角色,管理员与用户角色;
管理员角色包含以下功能:
查看预订,查看会议,部门管理,员工注册,添加会议室,审批员工等功能。
用户角色包含以下功能:
预定会议,查看我将参加的会议,会议室查看,通知信息查看,查看撤销会议等功能。
1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。
2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;
3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可
4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS;
5.数据库:MySql 5.7版本;
6.是否Maven项目:否;
JSP+CSS+JavaScript+html+mysql+servlet
1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;
若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行;
3. 将项目中dao/DBUtils.java配置文件中的数据库配置改为自己的配置;
4. 运行项目,输入localhost:8080/meeting/ 注:Tomcat中配置路径必须为meeting,否则会有异常;
管理员账号/密码:admin/admin
用户账号/密码:linyaokun/123456
用户角色
AddDepServlet
- package org.sang.servlet;
-
- import org.sang.service.DepartmentService;
-
- import javax.servlet.ServletException;
- import javax.servlet.http.HttpServlet;
- import javax.servlet.http.HttpServletRequest;
- import javax.servlet.http.HttpServletResponse;
- import java.io.IOException;
-
- /**
- * Created by sang on 2017/8/17.
- */
- public class AddDepServlet extends HttpServlet {
- private DepartmentService departmentService = new DepartmentService();
-
- @Override
- protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
- doPost(req, resp);
- }
-
- @Override
- protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
- String departmentname = req.getParameter("departmentname");
- int insert = departmentService.insert(departmentname);
- if (insert == 1) {
- resp.sendRedirect(req.getContextPath() + "/departments");
- } else {
- req.setAttribute("error", "添加失败");
- req.getRequestDispatcher("/departments").forward(req, resp);
- }
- }
- }
AddMeetingRoomServlet
- package org.sang.servlet;
-
- import org.sang.bean.MeetingRoom;
- import org.sang.service.MeetingRoomService;
-
- import javax.servlet.ServletException;
- import javax.servlet.http.HttpServlet;
- import javax.servlet.http.HttpServletRequest;
- import javax.servlet.http.HttpServletResponse;
- import java.io.IOException;
-
- /**
- * Created by sang on 2017/8/18.
- */
- public class AddMeetingRoomServlet extends HttpServlet {
- private MeetingRoomService meetingRoomService = new MeetingRoomService();
-
- @Override
- protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
- doPost(req, resp);
- }
-
- @Override
- protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
- String roomid = req.getParameter("roomid");
- String roomnum = req.getParameter("roomnum");
- String roomname = req.getParameter("roomname");
- String capacity = req.getParameter("capacity");
- String status = req.getParameter("status");
- String description = req.getParameter("description");
- MeetingRoom meetingRoom = new MeetingRoom(Integer.parseInt(roomnum), roomname, Integer.parseInt(capacity), Integer.parseInt(status), description);
- if (roomid == null || "".equals(roomid)) {
- //添加会议室
- int result = meetingRoomService.insert(meetingRoom);
- if (result == 1) {
- //去查看会议室页面
- resp.sendRedirect(req.getContextPath() + "/getallmr");
- } else {
- req.setAttribute("error", "添加失败");
- req.getRequestDispatcher("/addmeetingroom.jsp").forward(req, resp);
- }
- } else {
- //修改会议室
- meetingRoom.setRoomid(Integer.parseInt(roomid));
- int update = meetingRoomService.update(meetingRoom);
- if (update == 1) {
- resp.sendRedirect(req.getContextPath() + "/getallmr");
- }else{
- //更新失败
- }
- }
- }
- }
-
-
- package org.sang.servlet;
-
- import org.sang.bean.Employee;
- import org.sang.service.EmployeeService;
-
- import javax.servlet.ServletException;
- import javax.servlet.http.HttpServlet;
- import javax.servlet.http.HttpServletRequest;
- import javax.servlet.http.HttpServletResponse;
- import java.io.IOException;
- import java.util.List;
-
- /**
- * Created by sang on 2017/8/18.
- */
- public class ApproveaccountServlet extends HttpServlet {
- private EmployeeService employeeService = new EmployeeService();
-
- @Override
- protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
- doPost(req, resp);
- }
-
- @Override
- protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
- List
list = employeeService.getUnApproveaccount(); - req.setAttribute("list", list);
- req.getRequestDispatcher("/approveaccount.jsp").forward(req, resp);
- }
- }
-
BookMeetingServlet
- package org.sang.servlet;
-
- import org.sang.bean.MeetingRoom;
- import org.sang.service.MeetingRoomService;
-
- import javax.servlet.ServletException;
- import javax.servlet.http.HttpServlet;
- import javax.servlet.http.HttpServletRequest;
- import javax.servlet.http.HttpServletResponse;
- import java.io.IOException;
- import java.util.List;
-
- /**
- * Created by sang on 2017/8/21.
- */
- public class BookMeetingServlet extends HttpServlet {
- private MeetingRoomService meetingRoomService = new MeetingRoomService();
-
- @Override
- protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
- doPost(req, resp);
- }
-
- @Override
- protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
- List
list = meetingRoomService.getAllMeetingRoom(); - req.setAttribute("mrs", list);
- req.getRequestDispatcher("/bookmeeting.jsp").forward(req, resp);
- }
- }
-
- package org.sang.servlet;
-
- import org.sang.bean.Meeting;
- import org.sang.service.MeetingService;
-
- import javax.servlet.ServletException;
- import javax.servlet.http.HttpServlet;
- import javax.servlet.http.HttpServletRequest;
- import javax.servlet.http.HttpServletResponse;
- import java.io.IOException;
-
- /**
- * Created by sang on 2017/8/23.
- */
- public class CancelMeetingServlet extends HttpServlet {
- private MeetingService meetingService = new MeetingService();
-
- @Override
- protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
- doPost(req, resp);
- }
-
- @Override
- protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
- String mid = req.getParameter("mid");
- Meeting meeting = meetingService.getMeetingDetailsByMeetingId(Integer.parseInt(mid));
- req.setAttribute("m", meeting);
- req.getRequestDispatcher("/cancelmeeting.jsp").forward(req, resp);
- }
- }
-
-
- package org.sang.servlet;
-
- import org.sang.service.DepartmentService;
-
- import javax.servlet.ServletException;
- import javax.servlet.http.HttpServlet;
- import javax.servlet.http.HttpServletRequest;
- import javax.servlet.http.HttpServletResponse;
- import java.io.IOException;
-
- /**
- * Created by sang on 2017/8/17.
- */
- public class DeleteDepSerlvet extends HttpServlet {
- private DepartmentService departmentService = new DepartmentService();
-
- @Override
- protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
- doPost(req, resp);
- }
-
- @Override
- protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
- String depid = req.getParameter("depid");
- int i = departmentService.deleteDepById(Integer.parseInt(depid));
- if (i == 1) {
- resp.sendRedirect(req.getContextPath() + "/departments");
- } else {
- req.setAttribute("error", "删除失败");
- req.getRequestDispatcher("/departments").forward(req, resp);
- }
- }
- }
-
DoBookMeetingServlet
- package org.sang.servlet;
-
- import org.sang.bean.Employee;
- import org.sang.bean.Meeting;
- import org.sang.service.MeetingService;
-
- import javax.servlet.ServletException;
- import javax.servlet.http.HttpServlet;
- import javax.servlet.http.HttpServletRequest;
- import javax.servlet.http.HttpServletResponse;
- import java.io.IOException;
- import java.sql.Timestamp;
-
- /**
- * Created by sang on 2017/8/21.
- */
- public class DoBookMeetingServlet extends HttpServlet {
- private MeetingService meetingService = new MeetingService();
-
- @Override
- protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
- doPost(req, resp);
- }
-
- @Override
- protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
- String meetingname = req.getParameter("meetingname");
- String numberofparticipants = req.getParameter("numberofparticipants");
- String starttime = req.getParameter("starttime");
- String endtime = req.getParameter("endtime");
- String roomid = req.getParameter("roomid");
- String description = req.getParameter("description");
- String[] selSelectedEmployees = req.getParameterValues("selSelectedEmployees");
- //获取当前登录的用户对象
- Employee loginUser = (Employee) req.getSession().getAttribute("loginUser");
- Meeting meeting = new Meeting(meetingname, Integer.parseInt(roomid), loginUser.getEmployeeid(), Integer.parseInt(numberofparticipants), Timestamp.valueOf(starttime), Timestamp.valueOf(endtime), new Timestamp(System.currentTimeMillis()), description);
- meetingService.insert(meeting, selSelectedEmployees);
- resp.sendRedirect(req.getContextPath() + "/searchmeetings.html");
- }
- }
GetAllDepJsonServlet
- package org.sang.servlet;
-
- import com.google.gson.Gson;
- import org.sang.bean.Department;
- import org.sang.service.DepartmentService;
-
- import javax.servlet.ServletException;
- import javax.servlet.http.HttpServlet;
- import javax.servlet.http.HttpServletRequest;
- import javax.servlet.http.HttpServletResponse;
- import java.io.IOException;
- import java.util.List;
-
- /**
- * Created by sang on 2017/8/21.
- */
- public class GetAllDepJsonServlet extends HttpServlet {
- private DepartmentService departmentService = new DepartmentService();
- @Override
- protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
- doPost(req,resp);
- }
-
- @Override
- protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
- List
list = departmentService.getAllDepartment(); - resp.setContentType("application/json;charset=utf-8");
- resp.getWriter().write(new Gson().toJson(list));
- }
- }
GetAllMeetingRoomServlet
- package org.sang.servlet;
-
- import org.sang.bean.MeetingRoom;
- import org.sang.service.MeetingRoomService;
-
- import javax.servlet.ServletException;
- import javax.servlet.http.HttpServlet;
- import javax.servlet.http.HttpServletRequest;
- import javax.servlet.http.HttpServletResponse;
- import java.io.IOException;
- import java.util.List;
-
- /**
- * Created by sang on 2017/8/18.
- */
- public class GetAllMeetingRoomServlet extends HttpServlet {
- private MeetingRoomService meetingRoomService = new MeetingRoomService();
-
- @Override
- protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
- doPost(req, resp);
- }
-
- @Override
- protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
- List
allMeetingRoom = meetingRoomService.getAllMeetingRoom(); - req.setAttribute("list", allMeetingRoom);
- req.getRequestDispatcher("/meetingrooms.jsp").forward(req, resp);
- }
- }
如果也想学习本系统,下面领取。关注并回复:065jsp