• Java项目:JSP会议-会议室管理系统


    作者主页:源码空间站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

    1. package org.sang.servlet;
    2. import org.sang.service.DepartmentService;
    3. import javax.servlet.ServletException;
    4. import javax.servlet.http.HttpServlet;
    5. import javax.servlet.http.HttpServletRequest;
    6. import javax.servlet.http.HttpServletResponse;
    7. import java.io.IOException;
    8. /**
    9. * Created by sang on 2017/8/17.
    10. */
    11. public class AddDepServlet extends HttpServlet {
    12. private DepartmentService departmentService = new DepartmentService();
    13. @Override
    14. protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    15. doPost(req, resp);
    16. }
    17. @Override
    18. protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    19. String departmentname = req.getParameter("departmentname");
    20. int insert = departmentService.insert(departmentname);
    21. if (insert == 1) {
    22. resp.sendRedirect(req.getContextPath() + "/departments");
    23. } else {
    24. req.setAttribute("error", "添加失败");
    25. req.getRequestDispatcher("/departments").forward(req, resp);
    26. }
    27. }
    28. }

    AddMeetingRoomServlet

    1. package org.sang.servlet;
    2. import org.sang.bean.MeetingRoom;
    3. import org.sang.service.MeetingRoomService;
    4. import javax.servlet.ServletException;
    5. import javax.servlet.http.HttpServlet;
    6. import javax.servlet.http.HttpServletRequest;
    7. import javax.servlet.http.HttpServletResponse;
    8. import java.io.IOException;
    9. /**
    10. * Created by sang on 2017/8/18.
    11. */
    12. public class AddMeetingRoomServlet extends HttpServlet {
    13. private MeetingRoomService meetingRoomService = new MeetingRoomService();
    14. @Override
    15. protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    16. doPost(req, resp);
    17. }
    18. @Override
    19. protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    20. String roomid = req.getParameter("roomid");
    21. String roomnum = req.getParameter("roomnum");
    22. String roomname = req.getParameter("roomname");
    23. String capacity = req.getParameter("capacity");
    24. String status = req.getParameter("status");
    25. String description = req.getParameter("description");
    26. MeetingRoom meetingRoom = new MeetingRoom(Integer.parseInt(roomnum), roomname, Integer.parseInt(capacity), Integer.parseInt(status), description);
    27. if (roomid == null || "".equals(roomid)) {
    28. //添加会议室
    29. int result = meetingRoomService.insert(meetingRoom);
    30. if (result == 1) {
    31. //去查看会议室页面
    32. resp.sendRedirect(req.getContextPath() + "/getallmr");
    33. } else {
    34. req.setAttribute("error", "添加失败");
    35. req.getRequestDispatcher("/addmeetingroom.jsp").forward(req, resp);
    36. }
    37. } else {
    38. //修改会议室
    39. meetingRoom.setRoomid(Integer.parseInt(roomid));
    40. int update = meetingRoomService.update(meetingRoom);
    41. if (update == 1) {
    42. resp.sendRedirect(req.getContextPath() + "/getallmr");
    43. }else{
    44. //更新失败
    45. }
    46. }
    47. }
    48. }
    49. package org.sang.servlet;
    50. import org.sang.bean.Employee;
    51. import org.sang.service.EmployeeService;
    52. import javax.servlet.ServletException;
    53. import javax.servlet.http.HttpServlet;
    54. import javax.servlet.http.HttpServletRequest;
    55. import javax.servlet.http.HttpServletResponse;
    56. import java.io.IOException;
    57. import java.util.List;
    58. /**
    59. * Created by sang on 2017/8/18.
    60. */
    61. public class ApproveaccountServlet extends HttpServlet {
    62. private EmployeeService employeeService = new EmployeeService();
    63. @Override
    64. protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    65. doPost(req, resp);
    66. }
    67. @Override
    68. protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    69. List list = employeeService.getUnApproveaccount();
    70. req.setAttribute("list", list);
    71. req.getRequestDispatcher("/approveaccount.jsp").forward(req, resp);
    72. }
    73. }

    BookMeetingServlet

    1. package org.sang.servlet;
    2. import org.sang.bean.MeetingRoom;
    3. import org.sang.service.MeetingRoomService;
    4. import javax.servlet.ServletException;
    5. import javax.servlet.http.HttpServlet;
    6. import javax.servlet.http.HttpServletRequest;
    7. import javax.servlet.http.HttpServletResponse;
    8. import java.io.IOException;
    9. import java.util.List;
    10. /**
    11. * Created by sang on 2017/8/21.
    12. */
    13. public class BookMeetingServlet extends HttpServlet {
    14. private MeetingRoomService meetingRoomService = new MeetingRoomService();
    15. @Override
    16. protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    17. doPost(req, resp);
    18. }
    19. @Override
    20. protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    21. List list = meetingRoomService.getAllMeetingRoom();
    22. req.setAttribute("mrs", list);
    23. req.getRequestDispatcher("/bookmeeting.jsp").forward(req, resp);
    24. }
    25. }
    26. package org.sang.servlet;
    27. import org.sang.bean.Meeting;
    28. import org.sang.service.MeetingService;
    29. import javax.servlet.ServletException;
    30. import javax.servlet.http.HttpServlet;
    31. import javax.servlet.http.HttpServletRequest;
    32. import javax.servlet.http.HttpServletResponse;
    33. import java.io.IOException;
    34. /**
    35. * Created by sang on 2017/8/23.
    36. */
    37. public class CancelMeetingServlet extends HttpServlet {
    38. private MeetingService meetingService = new MeetingService();
    39. @Override
    40. protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    41. doPost(req, resp);
    42. }
    43. @Override
    44. protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    45. String mid = req.getParameter("mid");
    46. Meeting meeting = meetingService.getMeetingDetailsByMeetingId(Integer.parseInt(mid));
    47. req.setAttribute("m", meeting);
    48. req.getRequestDispatcher("/cancelmeeting.jsp").forward(req, resp);
    49. }
    50. }
    51. package org.sang.servlet;
    52. import org.sang.service.DepartmentService;
    53. import javax.servlet.ServletException;
    54. import javax.servlet.http.HttpServlet;
    55. import javax.servlet.http.HttpServletRequest;
    56. import javax.servlet.http.HttpServletResponse;
    57. import java.io.IOException;
    58. /**
    59. * Created by sang on 2017/8/17.
    60. */
    61. public class DeleteDepSerlvet extends HttpServlet {
    62. private DepartmentService departmentService = new DepartmentService();
    63. @Override
    64. protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    65. doPost(req, resp);
    66. }
    67. @Override
    68. protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    69. String depid = req.getParameter("depid");
    70. int i = departmentService.deleteDepById(Integer.parseInt(depid));
    71. if (i == 1) {
    72. resp.sendRedirect(req.getContextPath() + "/departments");
    73. } else {
    74. req.setAttribute("error", "删除失败");
    75. req.getRequestDispatcher("/departments").forward(req, resp);
    76. }
    77. }
    78. }

    DoBookMeetingServlet

    1. package org.sang.servlet;
    2. import org.sang.bean.Employee;
    3. import org.sang.bean.Meeting;
    4. import org.sang.service.MeetingService;
    5. import javax.servlet.ServletException;
    6. import javax.servlet.http.HttpServlet;
    7. import javax.servlet.http.HttpServletRequest;
    8. import javax.servlet.http.HttpServletResponse;
    9. import java.io.IOException;
    10. import java.sql.Timestamp;
    11. /**
    12. * Created by sang on 2017/8/21.
    13. */
    14. public class DoBookMeetingServlet extends HttpServlet {
    15. private MeetingService meetingService = new MeetingService();
    16. @Override
    17. protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    18. doPost(req, resp);
    19. }
    20. @Override
    21. protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    22. String meetingname = req.getParameter("meetingname");
    23. String numberofparticipants = req.getParameter("numberofparticipants");
    24. String starttime = req.getParameter("starttime");
    25. String endtime = req.getParameter("endtime");
    26. String roomid = req.getParameter("roomid");
    27. String description = req.getParameter("description");
    28. String[] selSelectedEmployees = req.getParameterValues("selSelectedEmployees");
    29. //获取当前登录的用户对象
    30. Employee loginUser = (Employee) req.getSession().getAttribute("loginUser");
    31. Meeting meeting = new Meeting(meetingname, Integer.parseInt(roomid), loginUser.getEmployeeid(), Integer.parseInt(numberofparticipants), Timestamp.valueOf(starttime), Timestamp.valueOf(endtime), new Timestamp(System.currentTimeMillis()), description);
    32. meetingService.insert(meeting, selSelectedEmployees);
    33. resp.sendRedirect(req.getContextPath() + "/searchmeetings.html");
    34. }
    35. }

    GetAllDepJsonServlet

    1. package org.sang.servlet;
    2. import com.google.gson.Gson;
    3. import org.sang.bean.Department;
    4. import org.sang.service.DepartmentService;
    5. import javax.servlet.ServletException;
    6. import javax.servlet.http.HttpServlet;
    7. import javax.servlet.http.HttpServletRequest;
    8. import javax.servlet.http.HttpServletResponse;
    9. import java.io.IOException;
    10. import java.util.List;
    11. /**
    12. * Created by sang on 2017/8/21.
    13. */
    14. public class GetAllDepJsonServlet extends HttpServlet {
    15. private DepartmentService departmentService = new DepartmentService();
    16. @Override
    17. protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    18. doPost(req,resp);
    19. }
    20. @Override
    21. protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    22. List list = departmentService.getAllDepartment();
    23. resp.setContentType("application/json;charset=utf-8");
    24. resp.getWriter().write(new Gson().toJson(list));
    25. }
    26. }

    GetAllMeetingRoomServlet

    1. package org.sang.servlet;
    2. import org.sang.bean.MeetingRoom;
    3. import org.sang.service.MeetingRoomService;
    4. import javax.servlet.ServletException;
    5. import javax.servlet.http.HttpServlet;
    6. import javax.servlet.http.HttpServletRequest;
    7. import javax.servlet.http.HttpServletResponse;
    8. import java.io.IOException;
    9. import java.util.List;
    10. /**
    11. * Created by sang on 2017/8/18.
    12. */
    13. public class GetAllMeetingRoomServlet extends HttpServlet {
    14. private MeetingRoomService meetingRoomService = new MeetingRoomService();
    15. @Override
    16. protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    17. doPost(req, resp);
    18. }
    19. @Override
    20. protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    21. List allMeetingRoom = meetingRoomService.getAllMeetingRoom();
    22. req.setAttribute("list", allMeetingRoom);
    23. req.getRequestDispatcher("/meetingrooms.jsp").forward(req, resp);
    24. }
    25. }

    如果也想学习本系统,下面领取。关注并回复:065jsp

     

  • 相关阅读:
    RS485modbus转Profinet网关协议连接富凌DZB300系列变频器配置方法
    QT报错The inferior stopped because it received a signal from the operating system
    【配置nacos】使用application.yml配置文件来配置spring-cloud-starter-alibaba-nacos-config
    2024年,如何使用chatgpt4.0为工作赋能?
    mac 升级node到指定版本
    c语言基础知识帮助理解(函数递归详解)
    Tableau同比卡片制作
    [附源码]Python计算机毕业设计Django医学图像管理平台
    在Go编程中调用外部命令的几种场景
    【C++】STL容器适配器栈和队列及优先队列&容器适配器
  • 原文地址:https://blog.csdn.net/m0_74967853/article/details/128031722