/* * ajax修改角色 * 返回json */ @Action( value = "/role/editRole", interceptorRefs = {@InterceptorRef("roleInterceptor")}, results = { @Result(name = "noLogin", type = "chain", location = "loginErrorAjax"), @Result(name = "noRoleAuthority", type = "chain", location = "noAuthorityAjax") }) public String editRole() throws Exception { result = new JSONObject(); role = new Role(false); if (roleName != null && roleId != null) { role.setRoleId(Integer.parseInt(roleId)); role.setRoleName(roleName); if (roleDescription != null) { role.setRoleDescription(roleDescription); } role.setRoleStatus(roleState); StringUtil.String2RoleAuthority(roleAuthority, role); roleService.updateRole(role); result.put("result", 1); if (role.getRoleStatus() == 1) { request.getServletContext().setAttribute("role_" + roleId, role); } } else { result.put("result", 2); } return "json"; }