xloadtree终于弄出些眉目,不过又有了新问题
xloadtree要求加载的xml文件格式是一定的,比较麻烦,今天弄了一下午,终于有些眉目,不过又有了新问题,文件如下
1。jsp显示
<script type= "text/javascript ">
var tree = new WebFXLoadTree( "列表 ", "showTree.do?GetType=0 ",null, "doNothing() ")
function doCategoryAction(name){
alert(name)
}
function doPriCategoryAction(name){
alert(name)
}
function doNothing()
{
}
tree.write(); //应该生成树了,但是没有显示
</script>
2。struts的action
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
// TODO Auto-generated method stub
String strXML = " <?xml version=\ "1.0\ " encoding=\ "gb2312\ "?> \n ";
strXML += "\t <tree> \n ";
int getType = Integer.parseInt((String)request.getParameter( "GetType "));
if (getType == 0){
//获取所有主分类的XML
strXML += MakePriCategorySetXML();
}
strXML += "\t </tree> \n ";
System.out.println(strXML);
return(mapping.findForward( "showtree "));
}
/**
* 创建每一个节点的XML文本
*/
private String MakeItemXML(String username, String action, String src,
String icon, String openIcon) {
String strXML = "\t ";
strXML += " <tree text=\ " "+username+ "\ " ";
strXML += " action=\ " "+action+ "\ " ";
if (src != null) {
strXML += " src=\ " &quo