java实现遍历树形菜单方法——TreeAction实现

 /**  
* @Title: TreeAction.java
* @Package org.web
* @Description: TODO该方法的主要作用:
* @author A18ccms A18ccms_gmail_com  
* @date 2017-5-6 下午11:27:32
* @version V1.0  
*/
package org.web;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;

import org.Service.IVoteTreeService;
import org.Service.impl.VoteTreeServiceImpl;

import com.alibaba.fastjson.JSON;
import com.opensymphony.xwork2.ActionSupport;

 /**   
 *    
 * 项目名称:testTree   
 * 类名称:TreeAction   
 * 类描述:   
 * 创建人:Mu Xiongxiong  
 * 创建时间:2017-5-6 下午11:27:32   
 * 修改人:Mu Xiongxiong   
 * 修改时间:2017-5-6 下午11:27:32   
 * 修改备注:   
 * @version    
 *    
 */
public class TreeAction extends ActionSupport {

	private JSONArray treejson;
	
	private IVoteTreeService voteService = new VoteTreeServiceImpl();

	public String getTree(){
		treejson = voteService.getTreeJson();
		return SUCCESS;
	}
	
	public JSONArray getTreejson() {
		return treejson;
	}

	public void setTreejson(JSONArray treejson) {
		this.treejson = treejson;
	}
	
	

}

原文地址:https://www.cnblogs.com/a1111/p/12816271.html