コード例 #1
0
 private String toImportExcel() {
   DistrictDao districtDao = new DistrictDao();
   List list = null;
   try {
     list = districtDao.loadAll();
   } catch (RuntimeException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   } finally {
     districtDao.close();
   }
   request.setAttribute("list", list);
   return "/config/macconfig/importexcel.jsp";
 }
コード例 #2
0
  /**
   * 查询所有的方法
   *
   * @return
   */
  private String list() {
    String where = getWhere();
    String jsp = "/config/macconfig/list.jsp";
    MacconfigDao dao = new MacconfigDao();
    setTarget(jsp);
    list(dao, where);

    DistrictDao districtDao = new DistrictDao();
    List districtList = null;
    try {
      districtList = districtDao.loadAll();
    } catch (RuntimeException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    districtDao.close();

    Hashtable hashtable = new Hashtable();

    List list = (List) request.getAttribute("list");
    if (list != null && list.size() > 0) {
      for (int i = 0; i < list.size(); i++) {
        Macconfig macconfig = (Macconfig) list.get(i);

        if (districtList != null && districtList.size() > 0) {
          for (int j = 0; j < districtList.size(); j++) {
            DistrictConfig districtConfig = (DistrictConfig) districtList.get(j);
            if (macconfig.getDiscrictid() == districtConfig.getId()) {
              hashtable.put(macconfig.getId(), districtConfig);
            }
          }
        }
      }
    }
    request.setAttribute("hashtable", hashtable);
    request.setAttribute("districtList", districtList);
    return jsp;
  }