——————————DescriptionStart——————————
运行环境 Java≥8、MySQL≥5.7、Tomcat≥8
开发工具 eclipse/idea/myeclipse/sts等均可配置运行
适用 课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb的SSM+Maven学生会管理系统(java+ssm+javascript+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; 5.数据库:MySql 5.7版本;
技术栈
后端:Spring+SpringMVC+Mybatis 2. 前端:HTML+CSS+JavaScript+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 String jsonString = JSON.toJSONString(resultBean, features); byte [] bout = null ; try { bout = jsonString.getBytes("UTF-8" ); } catch (UnsupportedEncodingException e1) { e1.printStackTrace(); } outputData(bout, response); } public static void outputData (byte [] bout, HttpServletResponse response) { response.setContentType("text/html;charset=utf-8" ); try { OutputStream out = response.getOutputStream(); out.write(bout); out.flush(); out.close(); } catch (IOException e) { e.printStackTrace(); } } } package net.dqsy.manager.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 return null ; } if (paramValues.length < 1 ) { return new int [0 ]; } int [] values = new int [paramValues.length]; for (int i = 0 ; i < paramValues.length; i++) { try { values[i] = Integer.parseInt(paramValues[i]); } catch (Exception e) { values[i] = defaultNum; } } return values; } catch (Exception e) { log.error(e.getMessage()); return new int [0 ]; } } public static double getDoubleParameter (HttpServletRequest request, String name, double defaultNum) { try { String temp = request.getParameter(name); if (temp != null && !temp.equals("" )) { double num = defaultNum; try { num = Double.parseDouble(temp); } catch (Exception ignored) { } return num; } else { return defaultNum; }
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 @Autowired private IOrganizationService organizationService; @RequestMapping(value = "list") public ModelAndView list (HttpServletRequest request, HttpServletResponse response) { Account currentAccount = (Account) request.getSession().getAttribute("currentAccount" ); Organization organization = organizationService.findOrganizationByAccountId(currentAccount.getId()); ModelAndView mav = new ModelAndView("organization/list" ); mav.getModel().put("organization" , organization); return mav; } @RequestMapping(value = "update") public ModelAndView update (HttpServletRequest request, HttpServletResponse response) { long orgId = ParamUtils.getLongParameter(request, "orgId" , 0L ); Organization organization = organizationService.findById(orgId); ModelAndView mav = new ModelAndView("organization/update" ); mav.getModel().put("organization" , organization); return mav; } @RequestMapping(value = "save") public String save (HttpServletRequest request, HttpServletResponse response) { long orgId = ParamUtils.getLongParameter(request, "orgId" , 0L ); String orgName = ParamUtils.getParameter(request, "orgName" , "未设定" ); String orgLogo = ParamUtils.getParameter(request, "orgLogo" , "" ); Organization organization = organizationService.findById(orgId); organization.setName(orgName); organization.setLogo(orgLogo); organizationService.updateOrganization(organization); return "redirect:/organization/list" ; } } package net.dqsy.manager.filter;
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 53 } } } long endTime=System.currentTimeMillis(); System.out.println("运行时间:" +String.valueOf(endTime-startTime)+"ms" ); String jsonString = JSON.toJSONString(result); byte [] bout = null ; try { bout = jsonString.getBytes("UTF-8" ); } catch (UnsupportedEncodingException e1) { e1.printStackTrace(); } ResultUtil.outputData(bout, response); } public void uploadvideo (HttpServletRequest request, HttpServletResponse response) throws IOException { String path =filePath + "/video" ; long startTime = System.currentTimeMillis(); CommonsMultipartResolver multipartResolver = new CommonsMultipartResolver( request.getSession().getServletContext()); Map<String, Object> result = new HashMap<>(); if (multipartResolver.isMultipart(request)) { MultipartHttpServletRequest multiRequest = (MultipartHttpServletRequest) request; Iterator iter = multiRequest.getFileNames(); while (iter.hasNext()) { MultipartFile file = multiRequest.getFile(iter.next().toString()); String fileName = file.getOriginalFilename(); fileName = UUID.randomUUID() + "-" + fileName; File targetFile = new File(path, fileName); if (!targetFile.exists()) { targetFile.mkdirs(); } if (file != null ) { file.transferTo(targetFile); result.put("state" ,"SUCCESS" ); result.put("original" , fileName); result.put("size" , file.getSize()); result.put("title" , fileName); String prefix=fileName.substring(fileName.lastIndexOf("." )); result.put("type" , prefix); if (System.getProperty("os.name" ).toLowerCase().indexOf("linux" ) >= 0 ) { domain = "http://www.csbishe.cn:15028/ssm_xueshenghui/" ; }else {
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 } } package net.dqsy.manager.web.util;public class LocalizationUtil { private static final String BUNDLE_NAME = "messages" ; private static final String MISSING_BUNDLE = "!Missing bundle {0}!" ; private static final String MISSING_KEY = "!{0}!" ; private static ClassLoader classLoader = LocalizationUtil.class.getClassLoader(); private LocalizationUtil () { } public static String getClientString (String key, HttpServletRequest request) { try { if (request == null ) { return getString(BUNDLE_NAME, key, null ); } return getString(BUNDLE_NAME, key, getLocale(request)); } catch (MissingResourceException e) { return '!' + key + '!' ; } } public static String getClientString (String key, Locale locale) { if (locale == null ) locale = Locale.CHINA; return getString(BUNDLE_NAME, key, locale); } public static String getClientString (String key, Object[] params, Locale locale) { try { return MessageFormat.format(getString(BUNDLE_NAME, key, locale), params); } catch (MissingResourceException e) { return '!' + key + '!' ; } }
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 for (int i = 0 ; i < cookies.length; i++) { if (cookies[i].getName().equalsIgnoreCase("su_locale" )) { localeInCookie = cookies[i].getValue(); localeValue = localeInCookie; break ; } } } if (!StringUtils.isBlank(localeValue)) { if (localeValue.equalsIgnoreCase("zh" )) { locale = Locale.CHINA; } else { locale = Locale.US; } } else { locale = Locale.CHINA; } if (!locale.equals(Locale.CHINA)) { locale = Locale.US; } return locale; } public static String getClientString (String key, Object[] params, HttpServletRequest request) { try { return MessageFormat.format(getString(BUNDLE_NAME, key, getLocale(request)), params); } catch (MissingResourceException e) { return '!' + key + '!' ; } } private static String getEnglishString (String bundleName, String key) { String message; try { ResourceBundle resourceBundle = ResourceBundle.getBundle(bundleName, Locale.ENGLISH, classLoader); message = getMessage(key, resourceBundle); } catch (MissingResourceException missingBundle) { message = getMissingBundleMessage(bundleName);
——————————PayStart——————————
项目链接: https://javayms.github.io?id=221422282105200cv https://javayms.pages.dev?id=221422282105200cv