附上代码:
public void getlinetree(HttpServletRequest request, HttpServletResponse response)
throws FileUploadException, IOException {
List<String> dws = xtglService.getAllMenuMname();// 获得一级节点名称
List<String> pids = xtglService.getAllMenuId();// 获得一级节点的pid
response.setContentType("text/html;charset=utf-8");
List<Object> list = new ArrayList<Object>();
if (!dws.isEmpty()) {
for (String dw : dws) {
for (String pid : pids) {
Map<String, Object> trees = new HashMap<String, Object>();
List<String> dys = xtglService.getAllMenuE(pid);// 获取二级节点名称
@SuppressWarnings("rawtypes")
List<Map> l = new ArrayList<Map>();
if (!dys.isEmpty()) {
for (String dy : dys) {
Map<String, Object> mapdys = new HashMap<String, Object>();
List<Map<?, ?>> xl = new ArrayList<Map<?, ?>>();
Map<String, Object> map2 = new HashMap<String, Object>();
HashMap<String, Object> map3 = new HashMap<String, Object>();
xl.add(map2);
mapdys.put("text", dy);
mapdys.put("state", "closed");
l.add(mapdys);
}
}
trees.put("text", dw);
trees.put("state", "closed");
trees.put("children", l);
list.add(trees);
}
}
}
System.out.println(JSONArray.fromObject(list));
response.getWriter().print(JSONArray.fromObject(list));
}
成了这样的效果,怎么解决,在线等,挺急的