本文实例讲解了jquery zTree异步加载,分享给大家供大家参考,具体内容如下
web.xml中Servlet配置如下:
JSP页面:
本文实例讲解了jquery zTree异步加载,分享给大家供大家参考,具体内容如下
web.xml中Servlet配置如下:
JSP页面:
Action代码:
@Override
public void doPost(HttpServletRequest request,IOException {
// System.out.println("--------doPost--------");
String id = request.getParameter("id");
String name = request.getParameter("name");
String level = request.getParameter("level");
String otherParam = request.getParameter("otherParam");
System.out.println(id + "|" + name + "|" + level + "|" + otherParam);
JSONObject json = new JSONObject();
List<HashMap<String,Object>> list = new ArrayList<HashMap<String,Object>>();
for(int i = 0; i < 5; i++){
HashMap<String,Object> hm = new HashMap<String,Object>(); //最外层,父节点
hm.put("id",id + i);//id<a href="/tag/shuxing/" target="_blank" class="keywords">属性</a> ,数据传递
hm.put("name",id + i); //name<a href="/tag/shuxing/" target="_blank" class="keywords">属性</a>,<a href="/tag/xianshi/" target="_blank" class="keywords">显示</a>节点<a href="/tag/mingcheng/" target="_blank" class="keywords">名称</a>
hm.put("pId",id);
list.add(hm);
}
JSONArray arr = new JSONArray(list);
json.put("success",true);
json.put("arr",arr);
System.out.println("--------json------" + json.toString());
response.getWriter().write(arr.toString());
// response.getWriter().write(json.toString());
// response.getWriter().write("[{pId:'2',name:'20',id:'20'}]");
}
}
以上就是jquery zTree异步加载实例分享给大家,希望对大家学习异步加载技术有所帮助。