logic:iterate 嵌套使用


    <logic:present name="SprTrees" scope="request">
     <logic:iterate id="sprtrees" name="SprTrees">

      <TR class=RowFirst>
       <TD width="76%" height=25>
        <IMG src="img/plus.gif" border=0>
        <bean:write name="sprtrees" property="sprFarthername"/>
       </TD>

       <TD align=middle width="14%" height=25>
        <NOBR></NOBR>
       </TD>
      </TR>
              <logic:iterate  name="sprtrees" property="spr" id="spr">
      <TR class=RowSecond>
       <TD width="76%" height=25>
        &nbsp;&nbsp;
        <IMG src="img/nofollow.gif" border=0><bean:write name="spr" property="name"/>
       </TD>

       <TD align=middle width="14%" height=25>
        <NOBR></NOBR>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
       </TD>
      </TR>
     </logic:iterate>
     </logic:iterate>
    </logic:present>

 

 

List fartherlist = sprivilegeManager.getSprParv("0");
  SPrivilege spr1;
  SPrivilege spr2;
  List sprlists=new ArrayList();
  SprTree sprtree=new SprTree();
  List sprlist = new ArrayList();
  for (int i = 0; i < fartherlist.size(); i++) {
   spr1 = (SPrivilege) fartherlist.get(i);
   sprtree.setSprFarthername(spr1.getName());
   sprtree.setSprvid(String.valueOf(spr1.getPrvid()));
   System.out.print("父类别名id:"+spr1.getPrvid());
   List childrenlist = sprivilegeManager.getSprParv(String.valueOf(spr1.getPrvid()));
   for (int j = 0; j < childrenlist.size(); j++) {
    spr2 = (SPrivilege) childrenlist.get(j);
    sprlist.add(spr2);
    
   }
   sprtree.setSpr(sprlist);
   sprlists.add(sprtree);
  }
  request.setAttribute("SprTrees", sprlists);

 

SprTree .java

package com.news.util;

import java.util.List;

import com.news.Hibernate.SPrivilege;

public class SprTree {
 private String sprFarthername;

 private String sprvid;

 private List spr;

 public List getSpr() {
  return spr;
 }

 public void setSpr(List spr) {
  this.spr = spr;
 }

 public String getSprFarthername() {
  return sprFarthername;
 }

 public void setSprFarthername(String sprFarthername) {
  this.sprFarthername = sprFarthername;
 }

 public String getSprvid() {
  return sprvid;
 }

 public void setSprvid(String sprvid) {
  this.sprvid = sprvid;
 }
}

©️2020 CSDN 皮肤主题: 大白 设计师: CSDN官方博客 返回首页
实付0元
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值