@RequestMapping(params = "method=setRefuseRequestCount", method = RequestMethod.POST) public String setRefuseRequestCount(@RequestParam("count") long count, ModelMap modelMap) { if (count <= 0) { modelMap.addAttribute("message", "非法的计数"); return "/admin/count"; } GlobalCounter.getCounter().set(count); modelMap.addAttribute("message", "设置成功!"); return getRefuseRequestCount(modelMap); }
@RequestMapping(params = "method=getRefuseRequestCount", method = RequestMethod.GET) public String getRefuseRequestCount(ModelMap modelMap) { modelMap.addAttribute("count", GlobalCounter.getCounter().get()); return "/admin/count"; }