基于javaweb和mysql的ssm+maven学生会管理系统(java+ssm+javascript+jsp+mysql)

私信源码获取及调试交流

私信源码获取及调试交流

运行环境

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版本;

技术栈

  1. 后端:Spring+SpringMVC+Mybatis 2. 前端:HTML+CSS+JavaScript+jsp
     * @param name       The name of the parameter you want to get
     * @param defaultNum The default value of a parameter, if the parameter can't be
     *                   converted into a long.
     */
    public static long[] getLongParameters(HttpServletRequest request, String name, long defaultNum) {
        String[] paramValues = request.getParameterValues(name);
        if (paramValues == null) {
            return null;
        }
        if (paramValues.length < 1) {
            return new long[0];
        }
        long[] values = new long[paramValues.length];
        for (int i = 0; i < paramValues.length; i++) {
            try {
                values[i] = Long.parseLong(paramValues[i]);
            } catch (Exception e) {
                values[i] = defaultNum;
            }
        }
        return values;
    }

    /**
     * Gets a parameter as a string.
     *
     * @param request The HttpServletRequest object, known as "request" in a JSP
     *                page.
     * @param name    The name of the parameter you want to get
     * @return The value of the parameter or null if the parameter was not found
     * or if the parameter is a zero-length string.
     */
    public static String getAttribute(HttpServletRequest request, String name) {
        return getAttribute(request, name, false);
    }

    /**
     * Gets a parameter as a string.
     *
     * @param request        The HttpServletRequest object, known as "request" in a JSP
     *                       page.
     * @param name           The name of the parameter you want to get
     * @param emptyStringsOK Return the parameter values even if it is an empty string.
     * @return The value of the parameter or null if the parameter was not
     * found.
     * @return The value of the parameter or null if the parameter was not found
     * or if the parameter is a zero-length string.
     */
    public static String getAttribute(HttpServletRequest request, String name) {
        return getAttribute(request, name, false);
    }

    /**
     * Gets a parameter as a string.
     *
     * @param request        The HttpServletRequest object, known as "request" in a JSP
     *                       page.
     * @param name           The name of the parameter you want to get
     * @param emptyStringsOK Return the parameter values even if it is an empty string.
     * @return The value of the parameter or null if the parameter was not
     * found.
     */
    public static String getAttribute(HttpServletRequest request, String name, boolean emptyStringsOK) {
        String temp = (String) request.getAttribute(name);
        if (temp != null) {
            if (temp.equals("") && !emptyStringsOK) {
                return null;
            } else {
                return temp;
            }
        } else {
            return null;
        }
    }

    @SuppressWarnings("unchecked")
    public static <T> T getAttribute(HttpServletRequest request, String name, Class<T> expectedClazz) {
        Object attributeVal = request.getAttribute(name);
        if (attributeVal == null) {
            return null;
        }
        if (expectedClazz.isAssignableFrom(attributeVal.getClass())) {
            return (T) attributeVal;
        }
        //throw new ClassCastException(attributeVal.getClass() + "cannot be cast into " + expectedClazz); //fail-fast
        return null;
    }

    /**
     * Gets an attribute as a boolean.
     *
     * @param request The HttpServletRequest object, known as "request" in a JSP
     *                page.
     * @param name    The name of the attribute you want to get
     * @return True if the value of the attribute is "true", false otherwise.
     */
    public static boolean getBooleanAttribute(HttpServletRequest request, String name) {
        String temp = (String) request.getAttribute(name);
            if (temp != null && !temp.trim().equals("")) {
                long num = defaultNum;
                try {
                    num = Long.parseLong(temp.trim());
                } catch (Exception ignored) {
                }
                return num;
            } else {
                return defaultNum;
            }
        } catch (Exception e) {
            log.error(e.getMessage());
            return defaultNum;
        }
    }

    public static Long getLongParameter(HttpServletRequest request, String name) {
        Long num = null;
        try {
            String temp = request.getParameter(name);
            if (StringUtils.isNoneBlank(temp)) {
                num = Long.parseLong(temp.trim());
            }
            return num;
        } catch (Exception ignore) {
            return num;
        }
    }

    /**
     * Gets a list of long parameters.
     *
     * @param request    The HttpServletRequest object, known as "request" in a JSP
     *                   page.
     * @param name       The name of the parameter you want to get
     * @param defaultNum The default value of a parameter, if the parameter can't be
     *                   converted into a long.
     */
    public static long[] getLongParameters(HttpServletRequest request, String name, long defaultNum) {
        String[] paramValues = request.getParameterValues(name);
        if (paramValues == null) {
            return null;
        }
    }

    /**
     * 调用成功,没有数据返回
     *
     * @param response
     */
    public static void fail(HttpServletResponse response) {
        fail("请求失败!", response);
    }

    public static void fail(String message, HttpServletResponse response) {
        addP3P(response);
        ResultBean resultBean = new ResultBean(false, message);
        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();
        }

    }

}

            return defaultNum;
        }
    }

    public static float getFloatParameter(HttpServletRequest request, String name, float defaultNum) {
        try {
            String temp = request.getParameter(name);
            if (temp != null && !temp.trim().equals("")) {
                float num = defaultNum;
                try {
                    num = Float.parseFloat(temp.trim());
                } catch (Exception ignored) {
                }
                return num;
            } else {
                return defaultNum;
            }
        } catch (Exception e) {
            log.error(e.getMessage());
            return defaultNum;
        }
    }

    /**
     * Gets a list of int parameters.
     *
     * @param request    The HttpServletRequest object, known as "request" in a JSP
     *                   page.
     * @param name       The name of the parameter you want to get
     * @param defaultNum The default value of a parameter, if the parameter can't be
     *                   converted into an int.
     */
    public static int[] getIntParameters(HttpServletRequest request, String name, int defaultNum) {
        try {
            String[] paramValues = request.getParameterValues(name);
            if (paramValues == null) {
                return null;
            }
            if (paramValues.length < 1) {
                return new int[0];
            }
        return mav;
    }

    @RequestMapping("list")
    public ModelAndView list(HttpServletRequest request, HttpServletResponse response){
        Account account = (Account) request.getSession().getAttribute("currentAccount");
        if (account == null) {
            ModelAndView mav = new ModelAndView("redirect:/index");
            return mav;
        }
        int start = ParamUtils.getIntParameter(request, "start", 1);
        int limit = ParamUtils.getIntParameter(request, "limit", 10);
        List<DepartmentApply> list = departmentApplyService.findApplyList(account.getId(), start, limit);
        if(list.size()> 0){
            for(DepartmentApply departmentApply :list){
                Department department = departmentService.findDepartmentById(departmentApply.getDepartmentId());
                if(department != null){
                    departmentApply.setDepartmentName(department.getName());
                    if (departmentApply.getType() == 6) {
                        departmentApply.setTypeName("部长");
                    } else if (departmentApply.getType() == 5) {
                        departmentApply.setTypeName("副部长");
                    } else if (departmentApply.getType() == 4) {
                        departmentApply.setTypeName("部员");
                    }
                }
                
                if(departmentApply.getStatus() == DepartmentApply.NEW&&accountService.findAccountById(departmentApply.getAccountId()).getType()!=6){
                    departmentApply.setStatusName("待审核");
                }else if(departmentApply.getStatus() == DepartmentApply.PASS||accountService.findAccountById(departmentApply.getAccountId()).getType()==6){
                    departmentApply.setStatusName("通过");
                }else if(departmentApply.getStatus() == DepartmentApply.REJECT){
                    departmentApply.setStatusName("拒绝");
                }
            }
        }
        int totalCount = departmentApplyService.getTotalCount(account.getId());
        String pagation = PageUtil.getPagation("/departmentApply/list", totalCount, start, limit);

        ModelAndView mav = new ModelAndView("departmentApply/list");
        mav.getModel().put("pageCode", pagation);
        mav.getModel().put("applyList", list);
        return mav;
    }

    @RequestMapping("getDepartmentList")

public class UeditController extends MultiActionController {

    String filePath= Thread.currentThread().getContextClassLoader().getResource("").getPath().substring(0,Thread.currentThread().getContextClassLoader().getResource("").getPath().length()-16);
    String domain = "";

    /**
     * @param request
     * @param response
     */
    public void config(HttpServletRequest request, HttpServletResponse response) throws IOException {

        Resource fileRource = new ClassPathResource("config.json");
        InputStream is = fileRource.getInputStream();
        InputStreamReader reader = new InputStreamReader(is, "UTF-8");
        BufferedReader bufferedReader = new BufferedReader(reader);
        response.setContentType("text/html;charset=UTF-8");
        PrintWriter out = response.getWriter();
        String line;
            }
        } else {
            // 如果uri中不包含/,则继续
            filterChain.doFilter(request, response);
        }
    }
}

/**
 * 获取ip地址 
 * ***/
public class IpUtil {
	
	
	/***
	 * 获取ip地址
	 * ***/
	public static String getIpStr(HttpServletRequest request)
	{
		 String ipAddress = null;   
		 //ipAddress = this.getRequest().getRemoteAddr();   
		 ipAddress = request.getHeader("x-forwarded-for");   
		 if(ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) {   
			 ipAddress = request.getHeader("Proxy-Client-IP");   
		 }   
		 if(ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) {   
			 ipAddress = request.getHeader("WL-Proxy-Client-IP");   
		 }   
		 if(ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) {   
			 
			 ipAddress = request.getRemoteAddr();   

			 if(ipAddress.equals("127.0.0.1")|| ipAddress.equals("0:0:0:0:0:0:0:1")){   
		      //根据网卡取本机配置的IP   
		        InetAddress inet=null;   
			    try {   
                    num = Integer.parseInt(temp);
                } catch (Exception ignored) {
                }
                return num;
            } else {
                return defaultNum;
            }
        } catch (Exception e) {
            log.error(e.getMessage());
            return defaultNum;
        }
    }

    public static float getFloatParameter(HttpServletRequest request, String name, float defaultNum) {
        try {
            String temp = request.getParameter(name);
            if (temp != null && !temp.trim().equals("")) {
                float num = defaultNum;
                try {
                    num = Float.parseFloat(temp.trim());
                } catch (Exception ignored) {
                }
                return num;
            } else {
                return defaultNum;
            }
        } catch (Exception e) {
            log.error(e.getMessage());
            return defaultNum;
        }
    }

    /**
     * Gets a list of int parameters.
     *
     * @param request    The HttpServletRequest object, known as "request" in a JSP
     *                   page.
     * @param name       The name of the parameter you want to get
     * @param defaultNum The default value of a parameter, if the parameter can't be
     *                   converted into an int.

@Controller
@RequestMapping("activity")
public class ActivityController{

    @Autowired
    private IActivityService activityService;
    @Autowired
    private SensitiveService sensitiveService;
    @Autowired
    private IDepartmentMemberService departmentMemberService;
    @RequestMapping(value = "list", method = RequestMethod.GET)
    public ModelAndView list(HttpServletRequest request, HttpServletResponse response){

        int type = ParamUtils.getIntParameter(request, "type", 1);
        int start = ParamUtils.getIntParameter(request, "start", 1);
        int limit = ParamUtils.getIntParameter(request, "limit", 10);
        int totalCount = activityService.getTotalCount(Arrays.asList(type));
        List<Activity> list = activityService.findList(Arrays.asList(type), start, limit);

        String pagation = PageUtil.getPagation("/activityRedirectController.do?action=list", totalCount, start, limit);

        ModelAndView mav = new ModelAndView("activity/list");
        mav.getModel().put("activityList", list);
        mav.getModel().put("pageCode", pagation);
        return mav;
    }

    @RequestMapping(value = "add", method = RequestMethod.GET)
    public ModelAndView add(HttpServletRequest request, HttpServletResponse response){
        ModelAndView mav = new ModelAndView("activity/activity_add");
        return mav;
    }

    @RequestMapping("addActivity")
    public void addActivity(HttpServletRequest request, HttpServletResponse response) throws ParseException {
        Account account = (Account) request.getSession().getAttribute("currentAccount");
        if (account == null) {
            ResultUtil.fail(response);
            return;
        }

        String title = ParamUtils.getParameter(request, "title");
        String subTitle = ParamUtils.getParameter(request, "subTitle");
			 
			 ipAddress = request.getRemoteAddr();   

			 if(ipAddress.equals("127.0.0.1")|| ipAddress.equals("0:0:0:0:0:0:0:1")){   
		      //根据网卡取本机配置的IP   
		        InetAddress inet=null;   
			    try {   
			        inet = InetAddress.getLocalHost();   
			    } catch (Exception e) {   
			     e.printStackTrace();   
			    }   
			    ipAddress= inet.getHostAddress();   
		     }   
		            
		 }   
		  
		 //对于通过多个代理的情况,第一个IP为客户端真实IP,多个IP按照','分割   
		 if(ipAddress!=null && ipAddress.length()>15){ //"***.***.***.***".length() = 15   
			 if(ipAddress.indexOf(",")>0){   
				 ipAddress = ipAddress.substring(0,ipAddress.indexOf(","));   
		     }   
		 }   
		 return ipAddress;
	}
	
	
}

@Controller
@RequestMapping("manage")
public class ManageRedirectController {
    @RequestMapping("")
    @RequestMapping(value = "detail")
    public void detail(HttpServletRequest request, HttpServletResponse response){
        Long account_id = ParamUtils.getLongParameter(request, "account_id", 0L);
        if(account_id == 0L){
            ResultUtil.fail(LocalizationUtil.getClientString("Account_22", request), response);
            return;
        }

        Account account = accountService.findAccountById(account_id);
        ResultUtil.success(account, response);

    }
    @RequestMapping(value = "delete")
    public void delete(HttpServletRequest request, HttpServletResponse response){
        Long account_id = ParamUtils.getLongParameter(request, "account_id", 0L);
        if(account_id == 0L){
            ResultUtil.fail(LocalizationUtil.getClientString("Account_22", request), response);
            return;
        }
        accountService.deteleById(account_id);

        Account account = accountService.findAccountById(account_id);
        ResultUtil.success(account, response);

    }

}

    }

    @RequestMapping("addActivity")
    public void addActivity(HttpServletRequest request, HttpServletResponse response) throws ParseException {
        Account account = (Account) request.getSession().getAttribute("currentAccount");
        if (account == null) {
            ResultUtil.fail(response);
            return;
        }

        String title = ParamUtils.getParameter(request, "title");
        String subTitle = ParamUtils.getParameter(request, "subTitle");
        int limitNum = ParamUtils.getIntParameter(request, "limitNum", 0);
        String startTime = ParamUtils.getParameter(request, "startTime");
        String endTime = ParamUtils.getParameter(request, "endTime");
        String content = ParamUtils.getParameter(request, "content");

        // 初始化时设置 日期和时间模式
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Date start = sdf.parse(startTime);
        Date end = sdf.parse(endTime);

        DepartmentMember member = departmentMemberService.findMemberByAccountId(account.getId());
        if(member == null){
            ResultUtil.fail(response);
            return;
        }
        Activity activity = new Activity();
        activity.setTitle(title);
        activity.setSubTitle(subTitle);
        activity.setContent(content);
        activity.setLimitNum(limitNum);
        activity.setStartTime(start);
        activity.setEndTime(end);
        activity.setDepartmentMemberId(member.getDepartmentId());
        activity.setDepartmentId(member.getDepartmentId());
        activity.setType(Activity.ACTIVITY);
        activityService.add(activity);
        ResultUtil.success(response);

    }

    @RequestMapping("detail")
    public ModelAndView detail(HttpServletRequest request, HttpServletResponse response){

        Long activityId = ParamUtils.getLongParameter(request, "activityId");

        Activity activity = activityService.findById(activityId);

        ModelAndView mav = new ModelAndView("activity/detail");
        mav.getModel().put("activity",activity);
                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 {
                    	domain = "http://localhost:8080/ssm_xueshenghui/";
                    }
                    result.put("url", domain + "images/" + fileName);
                    //resultList.add(result);
                }
            }
        }
        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";
        //List<Map<String, Object>> resultList = new ArrayList();
        long startTime = System.currentTimeMillis();
        //将当前上下文初始化给  CommonsMutipartResolver (多部分解析器)
        CommonsMultipartResolver multipartResolver = new CommonsMultipartResolver(
                request.getSession().getServletContext());
        //检查form中是否有enctype="multipart/form-data"
        Map<String, Object> result = new HashMap<>();
        if (multipartResolver.isMultipart(request)) {
            //将request变成多部分request
    private IOrganizationService organizationService;
    @RequestMapping(value = "list")
    public ModelAndView list(HttpServletRequest request, HttpServletResponse response){
        Account account = (Account) request.getSession().getAttribute("currentAccount");
        if (account == null) {
            ModelAndView mav = new ModelAndView("redirect:/index");
            return mav;
        }
        Organization organization = organizationService.findOrganizationByAccountId(account.getId());

        int start = ParamUtils.getIntParameter(request, "page", 1);
        int limit = ParamUtils.getIntParameter(request, "limit", 10);
        List<Department> list = departmentService.findList(organization.getId(), start, limit);
        int totalCount = departmentService.getTotalCount(organization.getId());

        String pagation = PageUtil.getPagation("/department/list", totalCount, start, limit);

        ModelAndView mav = new ModelAndView("department/list");
        mav.getModel().put("departmentList", list);
        mav.getModel().put("pageCode", pagation);
        return mav;
    }
    @RequestMapping(value = "detail")
    public void detail(HttpServletRequest request, HttpServletResponse response){
        Long departmentId = ParamUtils.getLongParameter(request, "department_id", 0L);
        if(departmentId == 0L){
            ResultUtil.fail(LocalizationUtil.getClientString("Account_22", request), response);
            return;
        }

        Department department = departmentService.findDepartmentById(departmentId);
        ResultUtil.success(department, response);
    }
    @RequestMapping(value = "delete")
    public void delete(HttpServletRequest request, HttpServletResponse response){
        Long departmentId = ParamUtils.getLongParameter(request, "department_id", 0L);
        if(departmentId == 0L){
            ResultUtil.fail(LocalizationUtil.getClientString("Account_22", request), response);
            return;
        }
        departmentService.deleteById(departmentId);
        ResultUtil.success(response);

    }

@Controller
@RequestMapping("organization")
public class OrganizationController {
    @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);
            return;
        }

        String title = ParamUtils.getParameter(request, "title");
        String subTitle = ParamUtils.getParameter(request, "subTitle");
        int limitNum = ParamUtils.getIntParameter(request, "limitNum", 0);
        String startTime = ParamUtils.getParameter(request, "startTime");
        String endTime = ParamUtils.getParameter(request, "endTime");
        String content = ParamUtils.getParameter(request, "content");

        // 初始化时设置 日期和时间模式
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Date start = sdf.parse(startTime);
        Date end = sdf.parse(endTime);

        DepartmentMember member = departmentMemberService.findMemberByAccountId(account.getId());
        if(member == null){
            ResultUtil.fail(response);
            return;
        }
        Activity activity = new Activity();
        activity.setTitle(title);
        activity.setSubTitle(subTitle);
        activity.setContent(content);
        activity.setLimitNum(limitNum);
        activity.setStartTime(start);
        activity.setEndTime(end);
        activity.setDepartmentMemberId(member.getDepartmentId());
        activity.setDepartmentId(member.getDepartmentId());
        activity.setType(Activity.ACTIVITY);
        activityService.add(activity);
        ResultUtil.success(response);

    }

    @RequestMapping("detail")
    public ModelAndView detail(HttpServletRequest request, HttpServletResponse response){

        Long activityId = ParamUtils.getLongParameter(request, "activityId");

        Activity activity = activityService.findById(activityId);

        ModelAndView mav = new ModelAndView("activity/detail");
	public static Locale getLocale(HttpServletRequest request) {
		// Locale locale = request.getLocale();
		Locale locale = Locale.CHINA;
		String localeValue = "";
		Cookie[] cookies = request.getCookies();
		if (cookies != null) {
			String localeInCookie = "";
			for (int i = 0; i < cookies.length; i++) {
				if (cookies[i].getName().equalsIgnoreCase("su_locale")) {
					localeInCookie = cookies[i].getValue();
					localeValue = localeInCookie;
					break;
				}
			}
		}
		// String localeInSession = (String)
		// request.getSession().getAttribute("locale");
		// System.out.println("localeInSession:"+localeInSession);
		// if (!StringUtil.isNull(localeInSession)) {
		// localeValue = localeInSession;
		// }
		if (!StringUtils.isBlank(localeValue)) {
			if (localeValue.equalsIgnoreCase("zh")) {
				locale = Locale.CHINA;
			} else {
				locale = Locale.US;
			}
		} else {
			/*
			 * Set default language be chinese. If you want to make it changed
			 * by browser, only open the blow; locale = request.getLocale();
			 */
			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);

请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述

Logo

汇聚全球AI编程工具,助力开发者即刻编程。

更多推荐