您的位置:首页 > 运维架构 > 网站架构

二维数组 第一次在网站中使用。。。。(代码 有待优化)

2013-08-20 13:58 330 查看
action
List<Company> qylist = companyService.getAll();
  List<Pingyi> pylist;
  cp = new String[qylist.size()][5];
  for(int j = 0;j<qylist.size();j++){
   cp[j][0] = qylist.get(j).getId()+"";
   cp[j][1] = "0";
   cp[j][2] = "0";
   cp[j][3] = "0";
   cp[j][4] = "0";
   pylist = pingyiService.findByProperty("company_id",qylist.get(j).getId()+"");
   for (int i = 0; i < pylist.size(); i++) {
    
     if (pylist.get(i).getManyidu().equals("非常满意")) {
      cp[j][1] = (Integer.parseInt(String.valueOf(cp[j][1]))+1)+"";
     }else if(pylist.get(i).getManyidu().equals("满意")){
      cp[j][2] = (Integer.parseInt(String.valueOf(cp[j][2]))+1)+"";
      
     }else if(pylist.get(i).getManyidu().equals("一般")){
      cp[j][3] = (Integer.parseInt(String.valueOf(cp[j][3]))+1)+"";
      
     }else if(pylist.get(i).getManyidu().equals("不满意")){
      cp[j][4] = (Integer.parseInt(String.valueOf(cp[j][4]))+1)+"";
      
     }
    
   }
   System.out.println("企业编号:"+cp[j][0]+"满意度调查:");
   System.out.println(""+cp[j][1]+"|"+cp[j][2]+"|"+cp[j][3]+"|"+cp[j][4]+"|");
  } -----------------------------------------------------------------------------------------------------------------------------------------------------------------
页面
 <c:forEach items="${clist.list}" var="stu">
              <c:forEach items="${cp}" var="stu1" varStatus="x">
             
             <c:if test="${stu.id==cp[x.index][0]}">
             <tr>
             <td width="40%" height="35" align="center" style="border-bottom-width: 1px;border-bottom-style: solid;border-bottom-color: #eeeeee;">${stu.company_name}</td>
              <td width="15%" align="center" style="border-bottom-width: 1px;border-bottom-style: solid;border-bottom-color: #eeeeee;">${cp[x.index][1]}</td>
              <td width="15%" align="center" style="border-bottom-width: 1px;border-bottom-style: solid;border-bottom-color: #eeeeee;">${cp[x.index][2]}</td>
              <td width="15%" align="center" style="border-bottom-width: 1px;border-bottom-style: solid;border-bottom-color: #eeeeee;">${cp[x.index][3]}</td>
              <td width="15%" align="center" style="border-bottom-width: 1px;border-bottom-style: solid;border-bottom-color: #eeeeee;">${cp[x.index][4]}</td>
            </tr>
            </c:if>
             
              </c:forEach>
              </c:forEach>
-----------------------------------------------------------------------------------------------------------------------------------------------------------------lele debug1.0
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: