String strSql = " select * from _tree";
List<Record> ls = Db.find(strSql);
List<TreeNode> mls = new ArrayList<TreeNode>();
for (int i = 0; i < ls.size(); i++) {
TreeNode m = new TreeNode();
m = m.put(ls.get(i));
mls.add(m);
}
TreeBuilder tree = new TreeBuilder();
renderJson(tree.buildListToTree(mls));
TreeNode m = new TreeNode();
m = m.put(ls.get(i));
System.out.println(m.getText());
m.getText()也是 null。
项目:JFinal
是:
改成 List ls = TreeNode.dao.find(strSql);
直接用即可了
否:
改成:
for( Record r : ls )
mls.add(new TreeNode().put(r));
renderJson(mls);
即可