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;
 }
}

你可能感兴趣的:(bean,String,list,Class,border)