public String config() throws Exception { QuartzConfig config = QuartzInstanceContainer.getQuartzConfig(uuid); HttpServletRequest request = ServletActionContext.getRequest(); // 得到request对象 HttpSession session = request.getSession(); // 通过request得到session对象 session.setAttribute("configName", config.getName()); session.setAttribute("configId", uuid); Result result = new Result(); result.setMessage("设置成功"); result.setCallbackType(""); JsonUtil.toJson(new Gson().toJson(result)); return null; }
@Override public String execute() throws Exception { configMap = QuartzInstanceContainer.getConfigMap(); Map<String, QuartzInstance> quartzInstanceMap = QuartzInstanceContainer.getQuartzInstanceMap(); if (quartzInstanceMap == null || quartzInstanceMap.size() == 0) { return super.execute(); } Set<String> keySet = quartzInstanceMap.keySet(); String key = null; for (Iterator<String> it = keySet.iterator(); it.hasNext(); ) { key = it.next(); break; } HttpServletRequest request = ServletActionContext.getRequest(); // 得到request对象 HttpSession session = request.getSession(); // 通过request得到session对象 session.setAttribute("configName", QuartzInstanceContainer.getQuartzConfig(key).getName()); session.setAttribute("configId", key); return super.execute(); }