コード例 #1
0
  /** 列表显示页面 分页显示总行时有问题,分页还需要测试 */
  public String list() throws Exception {
    HttpServletRequest request = Struts2Utils.getRequest();
    rolesList = baseRoleManager.getAll(); // 获取所有角色
    deptsList = baseDepartmentManager.getAll(); // 获取所有部门
    request.setAttribute("rolesList", rolesList);
    request.setAttribute("deptsList", deptsList);
    // 设置角色标识,供页面保留查询条件使用
    request.setAttribute("search_vcRoleNo", request.getParameter("vcRoleNo2"));
    // 设置部门标识,供页面保留查询条件使用
    request.setAttribute("search_vcDeptNo", request.getParameter("filter_LIKE_vcDeptNo"));

    // 调用分页方法
    this.setPaginationdataList();
    logger.error("日志测试");
    return INDEX;
  }
コード例 #2
0
  /**
   * 获取部门和角色信息
   *
   * @throws Exception
   */
  public void getAjaxXmlData() throws Exception {
    deptsList = baseDepartmentManager.getAll(); // 获取所有部门
    rolesList = baseRoleManager.getAll(); // 获取所有角色
    String deptXml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
    if (deptsList != null && !deptsList.isEmpty()) {
      deptXml = deptXml + "<root>";
      for (TbBaseDepartment dept : deptsList) {
        deptXml =
            deptXml
                + "<data>"
                + "<id>"
                + dept.getId()
                + "</id>"
                + "<name>"
                + dept.getVcDeptName()
                + "</name>"
                + "</data>";
      }
      deptXml = deptXml + "</root>";
    }

    String roleXml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
    if (rolesList != null && !rolesList.isEmpty()) {
      roleXml = roleXml + "<root>";
      for (TbBaseRoles role : rolesList) {
        roleXml =
            roleXml
                + "<data>"
                + "<id>"
                + role.getId()
                + "</id>"
                + "<name>"
                + role.getVcRolesName()
                + "</name>"
                + "</data>";
      }
      roleXml = roleXml + "</root>";
    }
    Struts2Utils.renderText(deptXml + "&&&" + roleXml);
  }