日期:2014-05-17  浏览次数:20557 次

如果有牛人,,,(虽然还不是我)
最近好几周都在搞一个动态菜单,利用了dtree控件,感觉问题出在$Ajax上边,求大神帮忙看看,很苦恼,搞不出来也很无语,不懂dtree的大神也可以帮我看看$Ajax这块是不是出了问题,个人感觉dtree这块不可能有错误
以下我详细列出我各个文件内容,劳烦各位


文件一
node类:

package com.dao;
public class Node {
private String nodeId;  
    private String parentId;
    private String nodeName;
    
    public String getNodeId() {  
        return nodeId;  
    }  
 
    public void setNodeId(String nodeId) {  
        this.nodeId = nodeId;  
    }  
    
    public String getParentId() {  
        return parentId;  
    }  
 
    public void setParentId(String parentId) {  
        this.parentId = parentId;  
    }  
    
    public String getNodeName() {  
        return nodeName;  
    }  
 
    public void setNodeName(String nodeName) {  
        this.nodeName = nodeName;  
    }  
}
------------------------------------------------------
文件二
DaoTest类:

package com.dao;
import java.sql.*;  
import java.util.*;

import com.dao.Node;
public class DaoTest {
private Connection conn = null;
public void initConnection() throws Exception {  
Class.forName("com.mysql.jdbc.Driver");  
        conn = DriverManager.getConnection("jdbc:mysql://localhost/tree","root","mysqladmin");  
}
public  ArrayList<Node> getNodeInfo() throws Exception{  
ArrayList<Node> nodes = new ArrayList<Node>();
initConnection();
String sql = "select id,pid,name from t_tree"; 
Statement stat=conn.createStatement();
ResultSet rs = stat.executeQuery(sql);
while (rs.next()){  
            Node node = new Node();  
            //node.setHrefAddress(rs.getString("hrefAddress"));  
            node.setNodeId(rs.getString("id"));  
            node.setParentId(rs.getString("pid"));  
            node.setNodeName(rs.getString("name"));  
            nodes.add(node);  
        }  
closeConnection();