——————————DescriptionStart——————————
运行环境 Java≥8、MySQL≥5.7、Tomcat≥8
开发工具 eclipse/idea/myeclipse/sts等均可配置运行
适用 课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb的JSP+Servlet会议室预约系统(java+jsp+bootstrap+servlet+mysql)
项目介绍
网上会议室预约系统,该项目是一个前后台的项目;
前台主要功能有: 登录、注册; 首页、预约须知; 会议室预约; 会议室信息; 会议室预约表; 后台主要功能有: 通告栏:查看、添加、修改、删除; 会议室信息:查看、添加、修改、删除; 查看登记表; 查看预约消息;
环境需要
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.是否Maven项目: 否;查看源码目录中是否包含pom.xml;若包含,则为maven项目,否则为非maven项目 6.数据库:MySql 8.0版本;
技术栈
后端:Servlet 2. 前端:JSP+bootstrap+jQuery
使用说明
使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 2. 将项目中druid.properties配置文件中的数据库配置改为自己的配置 3. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;若为maven项目,导入成功后请执行maven clean;maven install命令,配置tomcat,然后运行; 4. 运行项目, 前台运行地址:http://localhost:8080/index.jsp 登录 后台运行地址:http://localhost:8080/back/index.jsp 登录
——————————CodeStart——————————
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 if (count > 0 ){ request.setAttribute("msg" ,"已发送登记信息,请等待审核通过" ); request.getRequestDispatcher("regform.jsp" ).forward(request,response); }else { response.sendRedirect("errorPage.jsp" ); } }else { response.sendRedirect("login.jsp" ); } } } package com.xk.meeting.back.controller;@WebServlet("/back/addMeeting") public class AddMeetingServlet extends HttpServlet { protected void doPost (HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { this .doGet(request, response); } protected void doGet (HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.setCharacterEncoding("utf8" ); Map<String, String[]> meetingMap = request.getParameterMap(); Meeting meeting = new Meeting(); try { BeanUtils.populate(meeting,meetingMap); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } MeetingService meetingService = new MeetingServiceImpl(); int count = meetingService.addMeeting(meeting);
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 @WebServlet("/addApply") public class AddApplyServlet extends HttpServlet { protected void doPost (HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { this .doGet(request, response); } protected void doGet (HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.setCharacterEncoding("utf-8" ); Map<String, String[]> applyMap = request.getParameterMap(); Apply apply = new Apply(); try { ConvertUtils.register(new MyDateConverter(), Date.class); BeanUtils.populate(apply,applyMap); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } User user = (User)request.getSession().getAttribute("user" ); if (user != null ){ apply.setUid(user.getId()); ApplyService applyService = new ApplyServiceImpl(); int count = applyService.addApply(apply); if (count > 0 ){ request.setAttribute("msg" ,"已发送申请,等待审核通过" ); request.getRequestDispatcher("apply.jsp" ).forward(request,response); }else { response.sendRedirect("errorPage.jsp" ); } }else { response.sendRedirect("login.jsp" ); } } } package com.xk.meeting.controller;
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 e.printStackTrace(); } return null ; } } package com.xk.meeting.back.controller;@WebServlet("/back/modifyMeeting") public class ModifyMeetingServlet extends HttpServlet { protected void doPost (HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { this .doGet(request, response); } protected void doGet (HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.setCharacterEncoding("utf8" ); Map<String, String[]> meetingMap = request.getParameterMap(); Meeting meeting = new Meeting(); try { BeanUtils.populate(meeting,meetingMap); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } MeetingService meetingService = new MeetingServiceImpl();
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 public class UtilHelper { public static String getTime () { Date date = new Date(); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss" ); return sdf.format(date); } public static String dateToString (Date date) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss" ); return sdf.format(date); } public static DateTime createDateTime (int num, HttpServletRequest request) { LocalDate ld = LocalDate.now(); int week = ld.getDayOfWeek().getValue(); LocalDate date = ld.plusWeeks(num); LocalDate monday = date.plusDays(-(week-1 )); LocalDate tuesday = monday.plusDays(1 );
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 @WebServlet("/regForm") public class RegFormServlet extends HttpServlet { protected void doPost (HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { this .doGet(request, response); } protected void doGet (HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.setCharacterEncoding("utf-8" ); Map<String, String[]> regformMap = request.getParameterMap(); Regform regform = new Regform(); try { BeanUtils.populate(regform,regformMap); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } User user = (User)request.getSession().getAttribute("user" ); if (user != null ){ regform.setUid(user.getId()); RegformService regformService = new RegformServiceImpl(); int count = regformService.addRegform(regform); if (count > 0 ){ request.setAttribute("msg" ,"已发送登记信息,请等待审核通过" ); request.getRequestDispatcher("regform.jsp" ).forward(request,response); }else { response.sendRedirect("errorPage.jsp" ); } }else { response.sendRedirect("login.jsp" ); } } } package com.xk.meeting.back.controller;
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 String requestURI = request.getRequestURI(); if (UtilHelper.contains(requestURI,urls)){ chain.doFilter(request, response); }else { HttpSession session = request.getSession(); Admin admin = (Admin) session.getAttribute("admin" ); if (admin != null ){ chain.doFilter(request,response); }else { response.sendRedirect("login.jsp" ); } } } public void init (FilterConfig config) throws ServletException { String url = config.getInitParameter("url" ); String[] split = url.split("," ); urls = Arrays.asList(split); } } package com.xk.meeting.controller;@WebServlet("/modifyPassword") public class ModifyPasswordServlet extends HttpServlet { protected void doPost (HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { this .doGet(request, response); } protected void doGet (HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.setCharacterEncoding("utf8" ); String id = request.getParameter("id" ); String oldpass = request.getParameter("oldpass" ); String newpass = request.getParameter("newpass" ); UserService userService = new UserServiceImpl(); String password = userService.getPasswordById(Integer.parseInt(id)); if (password.equals(oldpass)){ int count = userService.updatePassword(id,newpass); if (count > 0 ){ request.setAttribute("msg" ,"修改成功" ); request.getRequestDispatcher("update.jsp" ).forward(request,response); }else {
——————————PayStart——————————
项目链接: https://javayms.github.io?id=561122512008200nm https://javayms.pages.dev?id=561122512008200nm