js里怎么遍历List
1个回答
展开全部
代码如下:
<SCRIPT language="javaScript">
var d = new dTree('d');
d.add(1,-1,"用户组","","","kunFrame");
<%
Object obj =request.getAttribute("custgrouplist");
List groupList = null;
int count =2;
String groupName = "";
int groupId = 0;
if(obj!=null)
{
groupList = (List)obj;
}
if(groupList!=null&&groupList.size()>0)
{
for(int i=0;i<groupList.size();i++)
{
CustGroup am = (CustGroup)groupList.get(i);
groupName = am.getVgroupName();
groupId = am.getGroupId();
// System.out.println(groupId);
%>
d.add(<%=count%>,1,'<%=groupName%>','<%=request.getContextPath()%>/showAreaByGroup.action?groupId=<%=groupId%>',"","kunFrame");
<%
count++;
}
}
%>
document.write(d);
</SCRIPT>
<SCRIPT language="javaScript">
var d = new dTree('d');
d.add(1,-1,"用户组","","","kunFrame");
<%
Object obj =request.getAttribute("custgrouplist");
List groupList = null;
int count =2;
String groupName = "";
int groupId = 0;
if(obj!=null)
{
groupList = (List)obj;
}
if(groupList!=null&&groupList.size()>0)
{
for(int i=0;i<groupList.size();i++)
{
CustGroup am = (CustGroup)groupList.get(i);
groupName = am.getVgroupName();
groupId = am.getGroupId();
// System.out.println(groupId);
%>
d.add(<%=count%>,1,'<%=groupName%>','<%=request.getContextPath()%>/showAreaByGroup.action?groupId=<%=groupId%>',"","kunFrame");
<%
count++;
}
}
%>
document.write(d);
</SCRIPT>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询