Map套map 前台jstl遍历

public String queryAdminPopedom()
	{
//		① 查询管理员人员列表
		Map<String,Object> adminMap = new HashMap<String, Object>();
		adminMap.put("eq,admin",Byte.valueOf("1"));
		List<UsertableT> userAdminList = this.menuService.getObjListByParameter(UsertableT.class, adminMap);
		ServletActionContext.getRequest().setAttribute("USER_ADMIN_LIST",userAdminList);
//		② 查询所有权限集合
		Map<MenuT,Map<MenuT,List<PowerlistT>>> map = this.menuService.queryPopedomMap();
		ServletActionContext.getRequest().setAttribute("POPEDOM_MAP",map);
		
//		JSONObject json = JSONObject.fromObject(map);
//		System.out.println("json = " + json);
		
		/* TEST 遍历
		Iterator<Map.Entry<MenuT,Map<MenuT,List<PowerlistT>>>> it = map.entrySet().iterator();
		while(it.hasNext()) 
		{
			Map.Entry<MenuT,Map<MenuT,List<PowerlistT>>> m = it.next();
			System.out.println("----"+m.getKey().getMenuName());
			
			Map<MenuT,List<PowerlistT>> mv = m.getValue();
			Iterator<Map.Entry<MenuT,List<PowerlistT>>> itv = mv.entrySet().iterator();
			while(itv.hasNext()) 
			{
				Map.Entry<MenuT,List<PowerlistT>> entry = itv.next();
				
				System.out.println("==== ="+entry.getKey().getMenuName());
				List<PowerlistT> list = entry.getValue();
				for(PowerlistT p:list)
				{
					System.out.println("==== =="+p.getPowerName());
				}
			}
		}
		*/
		return SUCCESS;
	}


public Map<MenuT, Map<MenuT, List<PowerlistT>>> queryPopedomMap() 
	{
		Map<MenuT,Map<MenuT,List<PowerlistT>>> map = new HashMap<MenuT, Map<MenuT,List<PowerlistT>>>();
		
		//1、查询父菜单为 parentno=0 的一级菜单
		Map<String,Object> menuMap1 = new HashMap<String, Object>();
		menuMap1.put("eq,parentNo","0");
		menuMap1.put("order,menuOrder", "desc");
		List<MenuT> menuList1 = this.getObjListByParameter(MenuT.class, menuMap1);
		
		//2、for循环 查询parentno的menuno的二级菜单
		for(MenuT m:menuList1)
		{
//			System.out.println("m.getMenuNo() = "+m.getMenuNo()+" "+m.getMenuName());
			Map<String,Object> menuMap2 = new HashMap<String, Object>();
			menuMap2.put("eq,parentNo",m.getMenuNo());
			List<MenuT> menuList2 = this.getObjListByParameter(MenuT.class, menuMap2);
			
			Map<MenuT,List<PowerlistT>> mapValue = new HashMap<MenuT, List<PowerlistT>>();
			
			//3、根据二级菜单的menuno查询powerlist的powername
			for(MenuT menu:menuList2)
			{
				Map<String,Object> menuMap3 = new HashMap<String, Object>();
				menuMap3.put("eq,menuNo",menu.getMenuNo());
				List<PowerlistT> powerList = this.getObjListByParameter(PowerlistT.class, menuMap3);
				
				mapValue.put(menu, powerList);
				
				/*for(PowerlistT p:powerList)
				{
					System.out.println(p.getPowerBak()+" "+p.getPowerName());
				}*/
			}
			map.put(m, mapValue);
		}
		
		return map;
	}



<div class="table_right">
	<!-- 
	<ul>
		<div class="titile">
			<input type="checkbox" value="" name=""><b>信息管理</b>
		</div>
		<li>
			<p><input type="checkbox" value="" name="">信息栏目</p><p><input type="checkbox" value="" name="">查看</p><p><input type="checkbox" value="" name="">管理</p>
		</li>
		<li>
			<p><input type="checkbox" value="" name="">信息录入</p><p><input type="checkbox" value="" name="">录入</p>
		</li>
		<li class="end">
			<p><input type="checkbox" value="" name="">信息管理</p><p><input type="checkbox" value="" name="">查看</p><p><input type="checkbox" value="" name="">管理</p>
		</li>
	</ul>
	 -->
	 <c:forEach items="${POPEDOM_MAP}" var="map">
	 	<ul>
	 		<div class="titile">
				<input type="checkbox" name="${map.key.menuNo }" id="${map.key.menuNo }" value="0" onclick="checkOneAllBox('${map.key.menuNo }')"></input>
				<b><c:out value="${map.key.menuName}"></c:out></b>
			</div>
		 	<c:forEach items="${map.value}" var="map2">
		 		<li>
					<p><input type="checkbox" name="${map2.key.menuNo}" id="${map2.key.menuNo}" value="0" onclick="checkTwoAllBox('${map2.key.menuNo }')"/><c:out value="${map2.key.menuName}"></c:out></p>
					<c:forEach items="${map2.value}" var="list">
						<p><input type="checkbox" name="${map2.key.menuNo}" value="${list.menuNo }:${list.powId }" /><c:out value="${list.powerName}"></c:out></p>
					</c:forEach>
				</li>
		 	</c:forEach>
		 </ul>
	 </c:forEach>
</div>

你可能感兴趣的:(jstl)