标签:
1. controller
@RequestMapping("/function.htm")
public String function(HttpSession session, Model model, RequestParameter param) {
pmap.clear();
List<FunctionSimple> listFunSimp = functionService.getFunctionSimpleList(pmap);
if (listFunSimp != null && listFunSimp.size() > 0) {
System.out.println(JSON.toJSON(listFunSimp).toString().replace("\"", "\‘"));
model.addAttribute("initnodes", JSON.toJSON(listFunSimp).toString().replace("\"", "\‘"));
}
return "auth/function";
}
2.jsp:
$(document).ready(function() {
var s = $(‘#hinitnodes‘).val();
if (s != "") {
s = s.replace(/\‘/g, "\"");
zNodes = JSON.parse(s);
}
$.fn.zTree.init($("#treeDemo"), setting, zNodes);
$("#selectAll").bind("click", selectAll);
});
<body>
<div class="content_wrap">
<input type="hidden" id="hinitnodes" name="hinitnodes" value="${initnodes}" />
<div class="zTreeDemoBackground left">
<ul id="treeDemo" class="ztree"></ul>
</div>
</div>
</body>
标签:
原文地址:http://www.cnblogs.com/wzz1020/p/5053283.html