/** * 获取手机验证码 * * @throws Exception */ public void getMessageCode() throws Exception { String mobile = getRequest().getParameter("mobile"); randCode = DataConfig.getRandomCode(); Map<String, String> map = new HashMap<String, String>(); map.put("mobile", mobile); map.put("code", randCode); Cookie cookieuser = new Cookie(mobile, randCode); cookieuser.setPath("/"); cookieuser.setMaxAge(600); this.getResponse().addCookie(cookieuser); System.out.println("手机号码:" + mobile + "\n验证码:" + randCode); String result = ClientWebService.sendSms("您的验证码是:" + randCode + ",工作人员不会向您索取,请勿向任何人泄露。", mobile); System.out.println("result......................:" + result); if (result.equals("32")) { this.printText("同一号码相同内容发送次数太多"); } }