js里怎么遍历List

如题所述

代码如下:
<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>
温馨提示:答案为网友推荐,仅供参考
相似回答