Ext treeはdwrと結合してバックグラウンドデータを呼び出します.


余計なことを言うな
dwr loaderが必要です
jsクラスを導入する

  <script type="text/javascript"
			src="${base}ext/adapter/ext/ext-base.js"></script>
		<script type="text/javascript" src="${base}ext/ext-all.js"></script>
		<script type="text/javascript"
			src="${base}ext/adapter/dwr/DWRTreeLoader.js"></script>

<script type=「text/javascript」src=「{base}ext/adapper/dwr/DWRT reeLoader.js」

  Ext.namespace("Ext.ux");
/**
 * @class Ext.ux.DWRTreeLoader
 * @extends Ext.tree.TreeLoader
 * @author Carina Stumpf
 *
 * DWRTreeloader loads tree nodes by calling a DWR service.
 * Version 2.1
 *
 */

/**
 * @constructor
 * @param cfg {Object} config A config object
 *    @cfg dwrCall the DWR function to call when loading the nodes
 */

Ext.ux.DWRTreeLoader = function(config) {
  Ext.ux.DWRTreeLoader.superclass.constructor.call(this, config);
};

Ext.extend(Ext.ux.DWRTreeLoader, Ext.tree.TreeLoader, {
/**
 * Load an {@link Ext.tree.TreeNode} from the DWR service.
 * This function is called automatically when a node is expanded, but may be used to reload
 * a node (or append new children if the {@link #clearOnLoad} option is false.)
 * @param {Object} node node for which child elements should be retrieved
 * @param {Function} callback function that should be called before executing the DWR call
 */
  load : function(node, callback) {
    var cs, i;
    if (this.clearOnLoad) {
      while (node.firstChild) {
        node.removeChild(node.firstChild);
      }
    }
    if (node.attributes.children && node.attributes.hasChildren) { // preloaded json children
      cs = node.attributes.children;
      for (i = 0,len = cs.length; i<len; i++) {
        node.appendChild(this.createNode(cs[i]));
      }
      if (typeof callback == "function") {
        callback();
      }
    } else if (this.dwrCall) {
      this.requestData(node, callback);
    }
  },

/**
 * Performs the actual load request
 * @param {Object} node node for which child elements should be retrieved
 * @param {Function} callback function that should be called before executing the DWR call
 */
  requestData : function(node, callback) {
    var callParams;
    var success, error, rootId, dataContainsRoot;

    if (this.fireEvent("beforeload", this, node, callback) !== false) {

      callParams = this.getParams(node);

      success = this.handleResponse.createDelegate(this, [node, callback], 1);
      error = this.handleFailure.createDelegate(this, [node, callback], 1);

      callParams.push({callback:success, errorHandler:error});

      this.transId = true;
      this.dwrCall.apply(this, callParams);
    } else {
      // if the load is cancelled, make sure we notify
      // the node that we are done
      if (typeof callback == "function") {
        callback();
      }
    }
  },

/**
 * Override this to add custom request parameters. Default adds the node id as first and only parameter
 */
  getParams : function(node) {
    return [node.id];
  },

/**
 * Handles a successful response.
 * @param {Object} childrenData data that was sent back by the server that contains the child nodes
 * @param {Object} parent parent node to which the child nodes will be appended
 * @param {Function} callback callback that will be performed after appending the nodes
 */
  handleResponse : function(childrenData, parent, callback) {
    this.transId = false;
    this.processResponse(childrenData, parent, callback);
  },

/**
 * Handles loading error
 * @param {Object} response data that was sent back by the server that contains the child nodes
 * @param {Object} parent parent node to which child nodes will be appended
 * @param {Function} callback callback that will be performed after appending the nodes
 */
  handleFailure : function(response, parent, callback) {
    this.transId = false;
    this.fireEvent("loadexception", this, parent, response);
    if (typeof callback == "function") {
      callback(this, parent);
    }
    console.log(e)("DwrTreeLoader: error during tree loading. Received response: " + response);
  },

/**
 * Process the response that was received from server
 * @param {Object} childrenData data that was sent back by the server that contains the attributes for the child nodes to be created
 * @param {Object} parent parent node to which child nodes will be appended
 * @param {Function} callback callback that will be performed after appending the nodes
 */
  processResponse : function(childrenData, parent, callback) {
    var i, n, nodeData;
    try {
      for (var i = 0; i<childrenData.length; i++) {
        var n = this.createNode(childrenData[i]);
        if (n) {
          n.hasChildren = childrenData[i].hasChildren;
          parent.appendChild(n);
        }
      }

      if (typeof callback == "function") {
        callback(this, parent);
      }
    } catch(e) {
      this.handleFailure(childrenData);
    }
  }
});
呼び出しの例

    Ext.onReady(function() {
     tree = new Ext.tree.TreePanel({
      el:'left-div',
      autoHeight:false,
      rootVisible:true,
      animate:false,
      autoScroll:true,
      selModel: new Ext.tree.MultiSelectionModel(),
      title: '${login_user.localName}   ',
      loader: new Ext.ux.DWRTreeLoader({
         dwrCall:filemanager.getMyFolderById
      }),

      root: new Ext.tree.AsyncTreeNode({        
         text: '      ',
         hasChildren:true,
         id:   'myroot'   //you could use a constant here or whatever fits best for your application
      })
     
  });
ページ呼び出しキーコード
loader:new Ext.ux.DWRT ree Loader({         dwrCall:filemanager.getMyFolderById      }),
サービスコード

public class FileManager extends EntityManager {
   ........
   public List<Folder> getMyFolderById(String parentid) {
		WebContext ctx = WebContextFactory.get();
		User owner = (User) ctx.getSession().getAttribute(
				AppContextVar.LOGIN_USER);
		if(owner==null)return null;
		List<Folder> folders = null;		
		DetachedCriteria criteria = DetachedCriteria.forClass(Folder.class);
		criteria.add(Restrictions.eq("owner", owner.getName()));
		criteria.add(Restrictions.eq("parent", parentid));
		folders = hibernate.findByCriteria(criteria);
		return folders;
	}  
  .........
}
Folderシンプルコード

   public class Folder implements Serializable {

	private String id;
	private String text;
	private boolean leaf;
	private Timestamp createTime;	
	private String parent;
	private String  owner;
	。。。。。。。
dwr関連の配置は配置しません.dwrのことは全部分かります.