扫二维码与项目经理沟通
我们在微信上24小时期待你的声音
解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流
<%@ page contentType="text/html;charset=UTF-8"%>
<%
if (request.getProtocol().compareTo("HTTP/1.0") == 0)
response.setHeader("Pragma", "no-cache");
if (request.getProtocol().compareTo("HTTP/1.1") == 0)
response.setHeader("Cache-Control", "no-cache");
response.setDateHeader("Expires", 0);
%>
ZTREE DEMO - Simple Data
public List getTreelist(){
//设定树菜单的根
String ztree = "{ id:00, pId:0, name:'要显示的根名,也可以从数据库取出', click:\"parent.setIframesrc()\" , open:true },";
List ztreeList = new ArrayList();
//从数据库获取所有菜单的信息
List menuList = this.getMenuList();
if(Collections.isNotEmpty(menuList)){
ztreeList.add(ztree);
for (int i = 0; i < menuList.size(); i++) {
Menu menu = (Menu) menuList.get(i);
//按照一定的格式拼接字符串,最后返回到jsp页面
ztree = "{ id:"+menu.getMenuid()+", pId:"+menu.getParentid()+", name:\""+menu.getMenuname()+"\"," +
"click:\"parent.setIframesrc('"+menu.getMenuid()+"')\"},";
if (i+1 == menuList.size()) {
ztree = ztree.substring(0, ztree.lastIndexOf(","));
}
ztreeList.add(ztree);
}
}
return ztreeList;
}
我们在微信上24小时期待你的声音
解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流