一个关于dtree的使用过程 <% @ page import = " java.util.*, java.sql.* " contentType = " text/html;charset=GB2312 " %> < jsp:useBean id = " treeVect " scope = " application " class = " shMachine.shMachine " /> < script type = " text/javascript " src = " dtree.js " ></ script > <% String tableName = " TASKBOX.SUB_ACT " ;Vector firstId = (Vector)treeVect.getId( " 18 " ,tableName);Vector firstClassName = (Vector)treeVect.getclassNameVect(firstId,tableName); for ( int i = 0 ;i < firstId.size();i ++ ) ... { %><input type="hidden" name="firstId" value="<%= firstId.elementAt(i).toString()%>"><input type="hidden" name="firstClassName" value="<%=firstClassName.elementAt(i).toString()%>"><%} Vector secondId = (Vector)treeVect.getId( " 21 " ,tableName);Vector secondClassName = (Vector)treeVect.getclassNameVect(secondId,tableName); for ( int j = 0 ;j < secondId.size();j ++ ) ... { %><input type="hidden" name="secondId" value="<%= secondId.elementAt(j).toString()%>"><input type="hidden" name="secondClassName" value="<%=secondClassName.elementAt(j).toString()%>"><%} Vector thirdId = (Vector)treeVect.getId( " 24 " ,tableName);Vector thirdClassName = (Vector)treeVect.getclassNameVect(thirdId,tableName); for ( int k = 0 ;k < thirdId.size();k ++ ) ... { %><input type="hidden" name="thirdId" value="<%=thirdId.elementAt(k).toString()%>"><input type="hidden" name="thirdClassName" value="<%=thirdClassName.elementAt(k).toString()%>"><%} String taskid = (String)session.getAttribute( " taskid " );String name = treeVect.getNewParameter(taskid, " TASKBOX.TASK " , " TASKNAME " ); %> < input type = " hidden " name = " taskname " value = " <%=name%> " > < script language = " javascript " > var grandfather = document.all.taskname.value; d = new dTree( ' d ' ); d.add( 0 , - 1 ,grandfather, ' uClassfalse.jsp?id=0 ' , '' , " view " ); if ( <%= firstId.size() %>== ' 1 ' ) ... { d.add(1,0,document.all.firstClassName.value,'uClassfalse.jsp?id='+document.all.firstId.value,'',"view"); for (j=0;j<<%=secondClassName.size()%>;j++) ...{ if(document.all.secondId(j).value.substring(0,18)==document.all.firstId.value) ...{ ///列出第二级CLASSNAME d.add(10+j,1,document.all.secondClassName(j).value,'uClassfalse.jsp?id='+document.all.secondId(j).value,'',"view"); for (k=0;k<<%=thirdId.size()%>;k++) ...{//列出第三级CLASSNAME if(document.all.thirdId(k).value.substring(0,21)==(document.all.secondId(j).value)) d.add(100+k,10+j,document.all.thirdClassName(k).value,'uClassfalse.jsp?id='+document.all.thirdId(k).value,'',"view"); } } } } else ... { for (i=0;i<<%=firstId.size()%>;i++) ...{ d.add(1+i,0,document.all.firstClassName(i).value,'uClassfalse.jsp?id='+document.all.firstId(i).value); for (j=0;j<<%=secondClassName.size()%>;j++) ...{ if(document.all.secondId(j).value.substring(0,18)==document.all.firstId(i).value) ...{ d.add(10+j,1+i,document.all.secondClassName(j).value,'uClassfalse.jsp?id='+document.all.secondId(j).value); for (k=0;k<<%=thirdId.size()%>;k++) ...{ if(document.all.thirdId(k).value.substring(0,21)==(document.all.secondId(j).value)) ...{ d.add(100+k,10+j,document.all.thirdClassName(k).value,'uClassfalse.jsp?id='+document.all.thirdId(k).value); } } } }} document.write(d);}