日期:2014-05-18  浏览次数:20744 次

jsp中怎么实现树的动态输出?
最近在研究jsp中树的动态输出,由于技术水平低,试了好多空间,都没有成功,大家一定要帮帮忙啊!万分感谢!!

------解决方案--------------------
百度一下 你就知道
------解决方案--------------------
我也在做相关的东西,希望高手能帮忙解决阿,最好能给一些具体的代码,非常谢谢!
------解决方案--------------------
是javascript的作的树目录吗?
我倒是有那个插件了
阿赖组件
你在百度摆一下就OK拉
------解决方案--------------------
<%@ page import="com.jenkov.prizetags.tree.impl.TreeNode,
com.jenkov.prizetags.tree.impl.Tree,
com.jenkov.prizetags.tree.itf.*"%>
<%@page import="java.util.*,org.spring.dao.factory.DaoFactory" %>
<%@page import="net.rate.dao.*" %>
<%@page import="net.rate.manager.*" %>
<%@page import="net.rate.deal.*" %>
<%@page import="net.rate.definevariable.* , org.spring.jdbc.core.DateAccessException" %> 
<%@ taglib uri="/WEB-INF/treetag.tld" prefix="tree" %>
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage=""%>
<%@ include file="../golbal/connection.jsp"%>
<html>
<head>
<%
//ΪʲôÊ÷»á»ØÈ¥ÒòΪnew
PublicManager pub=new PublicManager();

String newtree=request.getParameter("new");
if(newtree==null) newtree="";
if(newtree.equals("yes"))
{ ITree tree = new Tree();
tree.setSingleSelectionMode(true);
ITreeNode root = new TreeNode( ("r-root") , "µçÄÔ³öÈëÃ÷ϸ" , "");
 
String node1id="",node1name="",node2id="",node2name="";
try{
List list=pub.getcoms("","" ,"", "");
Iterator iterator= list.iterator();
while(iterator.hasNext())
{
Company obj1=(Company)iterator.next();
node1id=obj1.getCshort();
node1name="<img src=\"../images/gif/comid.gif\" width=\"13\" height=\"11\" border=\"0\">"+obj1.getC_name();
ITreeNode comp = new TreeNode( node1id ,node1name ,"");
root.addChild(comp);

PeijianM deal=new PeijianM();
List list2=deal.getkclb(node1id);
Iterator iterator2= list2.iterator();
while(iterator2.hasNext()){
Peijian obj2=(Peijian)iterator2.next(); 
node2id=obj2.getPm()+"¢Ù"+obj2.getGg()+"¢Ú"+obj2.getCom();
node2name="<img src=\"../images/gif/kc.gif\" border=\"0\">"+obj2.getPm()+" "+obj2.getGg()+"<br><font color=\"#00CC00\">½ø<font color=\"#003399\">"+obj2.getRq()+"</font>³ö<font color=\"#003399\">"+obj2.getSl()+"</font>&nbsp;¿â´æ<font color=\"#003399\">"+obj2.getXlh()+"<br>&nbsp;</font></font>";
ITreeNode pc= new TreeNode( node2id ,node2name , "");
comp.addChild(pc);
}
}
}
catch(DateAccessException e)
{ out.println(e);} 
tree.setRoot(root);
tree.expand(root.getId());
session.setAttribute("pctree", tree);
}
%>

<meta http-equiv=&q