0

我是 GWT GWT-EXT 的新手,我模仿它的演示问题是我应该把xml文件放在哪里

final TreePanel treePanel = new TreePanel() {
        {
            setAnimate(true);
            setEnableDD(true);
            setContainerScroll(true);
            setRootVisible(true);
        }
    };

 final XMLTreeLoader loader = new XMLTreeLoader() {
        {
            setDataUrl("countries-cb.xml");
            setMethod("get");
            setRootTag("countries");
            setFolderIdMapping("@id");
            setLeafIdMapping("@id");
            setFolderTitleMapping("@title");
            setFolderTag("team");
            setLeafTitleMapping("@title");
            setLeafTag("country");
            setQtipMapping("@qtip");
            setDisabledMapping("@disabled");
            setCheckedMapping("@checked");
            setIconMapping("@icon");
            setAttributeMappings(new String[]{"@rank"});
        }
    };
    AsyncTreeNode root = new AsyncTreeNode("Countries", loader);

    treePanel.setRootNode(root);
    treePanel.render();

    root.expand();
    treePanel.expandAll();
4

2 回答 2

0

请参阅: http: //gwt-ext.com/docs/2.0.4/com/gwtext/client/widgets/tree/TreeLoader.html#setDataUrl%28java.lang.String%29

setDataUrl 采用 XML 数据源的 URL 参数。

也许您被困在“我如何提供 XML 文件”上?

于 2010-06-09T11:08:22.020 回答
0

我把它放在下面projectName/war/projectName/xmlfile.xml,效果很好。

于 2010-06-09T11:14:43.627 回答