Extjs Tree + JSON + Struts2 例子
然后是struts.xml
6. html页面和js
我使用的就是extjs的example中的reorder.html和reorder.js,更改了reorder.js中treeloader的dataurl: menus.action
js:1 /* 2. * Ext JS Library 2.0.1 3. * Copyright(c) 2006-2008, Ext JS, LLC. 4. * licensing@extjs.com 5. * 6. * http://extjs.com/license 7. */ 8. 9. Ext.onReady(function(){ 10. // shorthand 11. var Tree = Ext.tree; 12. 13. var tree = new Tree.TreePanel({ 14. el:'tree-div', 15. autoScroll:true, 16. animate:true, 17. enableDD:true, 18. containerScroll: true, 19. loader: new Tree.TreeLoader({ 20. dataUrl:'http://localhost:8080/lab/menus.action' 21. }) 22. }); 23. 24. // set the root node 25. var root = new Tree.AsyncTreeNode({ 26. text: 'Ext JS', 27. draggable:false, 28. id:'source' 29. }); 30. tree.setRootNode(root); 31. 32. // render the tree 33. tree.render(); 34. root.expand(); 35. });
1 楼 javaAlpha 2010-05-18 楼主 最后把项目和lib的jar单独分开压缩一下。