——————————DescriptionStart——————————
运行环境
Java≥8、MySQL≥5.7、Tomcat≥8
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明






基于javaweb的JSP+Servlet高校社团管理系统(java+servlet+jsp+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;
使用技术 使用技术:servlet+jsp+mysql 8.0
使用说明
- 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;注:数据库使用mysql 8.0,注意版本要匹配,否则可能会产生连接异常的情况, 2. 将项目中db.properties配置文件中的数据库配置改为自己的配置 3. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;若为maven项目,导入成功后请执行maven clean;maven install命令,配置tomcat,然后运行;
前台地址:http://localhost:8080/team/front/login.jsp 普通社员账号:苏c 密码:123
后台地址:http://localhost:8080/team/mui/login.jsp 管理员账号:sys 密码:123456 社长账号:苏悲 密码:123456
——————————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 35 36 37 38 39 40 41 42 43 44 45 46 47
| @WebServlet("/menu") public class MenuController extends HttpServlet { private static final long serialVersionUID = 1L; private String contextPath = ""; MenuDao menuDao=new MenuDao(); MenuService menuService = new MenuServiceImpl(); MenuRoleDao menuRoleDao = new MenuRoleDao(); protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doPost(request, response); } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { contextPath = request.getServletContext().getContextPath(); String method = request.getParameter("method"); if ("add".equals(method)) { add(request,response); }else if ("delete".equals(method)) { delete(request, response); }else if ("list".equals(method)) { list(request, response); }else if ("update".equals(method)) { update(request, response); }else if ("form".equals(method)) { form(request, response); }else if ("save".equals(method)) { save(request, response); }else if ("setMenuRole".equals(method)) { setMenuRole(request, response); }else if ("saveMenuRole".equals(method)) { saveMenuRole(request, response); } } private void add(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String name = request.getParameter("name"); String href = request.getParameter("href"); String target = request.getParameter("target"); String isShow = request.getParameter("isShow"); String sort = request.getParameter("sort"); String parentId = request.getParameter("parentId");
|
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 47 48 49 50 51 52
| menu.setParentId(parentId); menu.setParentIds(parentIds); menu.setRemarks(remarks); menuService.add(menu); response.sendRedirect(contextPath+"/menu?method=list"); }
protected void save(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Menu menu = new Menu(); String savePath = this.getServletContext().getRealPath("/upload"); File file = new File(savePath); if (!file.exists() && !file.isDirectory()) { System.out.println(savePath+"目录不存在,需要创建"); file.mkdir(); } String msg = ""; try{ DiskFileItemFactory factory = new DiskFileItemFactory(); ServletFileUpload upload = new ServletFileUpload(factory); upload.setHeaderEncoding("UTF-8"); if(!ServletFileUpload.isMultipartContent(request)){ return; } List<FileItem> list = upload.parseRequest(request); for(FileItem item : list){ if(item.isFormField()){ String name = item.getFieldName(); if ("id".endsWith(name)) { if (item.getString("UTF-8")!=null && item.getString("UTF-8")!="") { menu.setId(item.getString("UTF-8")); } } if ("name".endsWith(name)) { menu.setName(item.getString("UTF-8")); } if ("href".endsWith(name)) { menu.setHref(item.getString("UTF-8")); }
|
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
| @WebServlet("/siteNews") public class SiteNewsController extends HttpServlet { private static final long serialVersionUID = 1L; private String contextPath = ""; SiteNewsDao siteNewsDao=new SiteNewsDao(); SiteNewsService siteNewsService = new SiteNewsServiceImpl(); TeamsService teamsService = new TeamsServiceImpl(); MoneyMangerService moneyMangerService = new MoneyMangerServiceImpl(); protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doPost(request, response); } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { contextPath = request.getServletContext().getContextPath(); String method = request.getParameter("method"); if ("add".equals(method)) { add(request,response); }else if ("delete".equals(method)) { delete(request, response); }else if ("list".equals(method)) { list(request, response); }else if ("update".equals(method)) { update(request, response); }else if ("form".equals(method)) { form(request, response); }else if ("save".equals(method)) { save(request, response); }else if ("main".equals(method)) {
|
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 47
| private String contextPath = ""; MoneyMangerDao moneyMangerDao=new MoneyMangerDao(); MoneyMangerService moneyMangerService = new MoneyMangerServiceImpl(); SiteNewsService siteNewsService = new SiteNewsServiceImpl(); protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doPost(request, response); } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { contextPath = request.getServletContext().getContextPath(); String method = request.getParameter("method"); if ("save".equals(method)) { save(request,response); }else if ("delete".equals(method)) { delete(request, response); }else if ("list".equals(method)) { list(request, response); }else if ("form".equals(method)) { form(request, response); } } protected void save(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { MoneyManger moneyManger = new MoneyManger(); String savePath = this.getServletContext().getRealPath("/upload"); File file = new File(savePath); if (!file.exists() && !file.isDirectory()) { System.out.println(savePath+"目录不存在,需要创建"); file.mkdir(); }
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| request.getRequestDispatcher("/views/team/activeStuList.jsp").forward(request, response); } private void form(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String id = request.getParameter("id"); ActiveStu activeStu = new ActiveStu(); if (id!=null && id!="") { activeStu = activeStuService.getById(id); } request.setAttribute("activeStu", activeStu); request.getRequestDispatcher("/views/team/activeStuForm.jsp").forward(request, response); } } package com.so.team.controller;
@WebServlet("/teams")
|
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 47
| private String contextPath = "";
MenuDao menuDao=new MenuDao(); MenuService menuService = new MenuServiceImpl(); MenuRoleDao menuRoleDao = new MenuRoleDao();
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doPost(request, response); }
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { contextPath = request.getServletContext().getContextPath(); String method = request.getParameter("method"); if ("add".equals(method)) { add(request,response); }else if ("delete".equals(method)) { delete(request, response); }else if ("list".equals(method)) { list(request, response); }else if ("update".equals(method)) { update(request, response); }else if ("form".equals(method)) { form(request, response); }else if ("save".equals(method)) { save(request, response); }else if ("setMenuRole".equals(method)) { setMenuRole(request, response); }else if ("saveMenuRole".equals(method)) { saveMenuRole(request, response); } }
private void add(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String name = request.getParameter("name"); String href = request.getParameter("href"); String target = request.getParameter("target"); String isShow = request.getParameter("isShow"); String sort = request.getParameter("sort"); String parentId = request.getParameter("parentId"); String parentIds = request.getParameter("parentIds"); String remarks = request.getParameter("remarks"); Menu menu = new Menu(); menu.setName(name); menu.setHref(href);
|
——————————PayStart——————————
项目链接:
https://javayms.github.io?id=321122542008200st
https://javayms.pages.dev?id=321122542008200st