java+mysql中使用梅花雪树型控件,想实现动态的树型,但一直都不显示
刚开载时是ASP+access的,可以运行,后来改成jsp+access的也可以运行
但改成java+mysql后,就一直不显示。搞不清楚为什么,下面贴出代码大家帮帮忙
JSP页面: <%
WebBean wb = new Tree(request, response);
WebData wd = wb.getPageData();
WebData strTree = (WebData) wd.getHeaderData( "strTree ");
%>
<body bgcolor= "ffffff " text= "#000000 ">
<SCRIPT LANGUAGE= "JavaScript ">
<!--
window.tree = new MzTreeView( "tree ");
tree.icons[ "property "] = "property.gif ";
tree.icons[ "css "] = "collection.gif ";
tree.icons[ "book "] = "book.gif ";
tree.iconsExpand[ "book "] = "bookopen.gif "; //展开时对应的图片
tree.setIconPath( "../img/ "); //可用相对路径
<%
try{
while(strTree.next()){
String tree;
System.out.println(strTree.getDetailString( "ParentId "));
System.out.println(strTree.getDetailString( "id "));
Integer parentId = new Integer(strTree.getDetailString( "ParentId "));
Integer id = new Integer(strTree.getDetailString( "id "));
tree= "\n "+ "tree.nodes[\ " "+parentId+ "_ "+id+ "\ "]=\ " ";
tree += "text: "+strTree.getDetailString( "Text ")+ "; ";
tree += "hint: "+strTree.getDetailString( "Hint ")+ "; ";
tree += "data: "+strTree.getDetailString( "Data ")+ "; ";
tree += "url: "+strTree.getDetailString( "Url ")+ "; ";
tree += "target: "+strTree.getDetailString( "Target ")+ "; ";
tree += "method: "+strTree.getDetailString( "Method ")+ "; ";
tree += "\ " ";
out.println(tree);
}
}
catch(Exception ex){
out.println(ex.toString());
}
%>
//tree.setURL( ".jsp ");
tree.setTarget( "main ");
document.write(tree.toString());
//-->
</SCRIPT>
下面是运行后查看的JSP源文件:
<SCRIPT LANGUAGE= "JavaScript ">
<!--
window.tree = new MzTreeView( "tree ");
tree.icons[ "property "] = "property.gif ";
tree.icons[ "css "] = "collection.gif ";
tree.icons[ "book "] = "book.gif ";
tree.iconsExpand[ "book "] = "bookopen.gif "; //展开时对应的图片
tree.setIconPath( "../img/ "); //可用相对路径
tree.nodes[ "0_1 "]= "text:gffsdf;hint:;data:;url:http://www.javaren.com.cn;target:;method:; "
tree.nodes[ "1_2 "]= "text:aaa;hint:;data:;url:fsadf;target:;method:; "
//tree.setURL( ".jsp ");
tree.setTarget( "main ");
document.write(tree.toString());
//-->
</SCRIPT>
搞了一夜了,实在看不出来原因了,我先睡一觉,谢谢大家了
------解决方案--------------------
这个问题你还是去问梅花雪吧,他经常在WEB开发JAVASCRIPT里出现,哈哈