c:forEach 标签中遍历map集合

java 后台map 集合封装

List list = rrmapper.selectByROID(String.valueOf(role));
        		Map> map = new HashMap>();
        		List rights = new ArrayList(); //一级菜单
        		for (RoleRight li : list){
        			Right right = rightmapper.selectByPrimaryKey(li.getRid());
        			System.out.println(right.getRname()+";;"+right.getPid() + ";;"+right.getRid());
        			if(right.getPid().equals("0")){
        				rights.add(right); //一级菜单
        			}
        			
        		}
        		//二级菜单
        		for(Right ri : rights){
        			List ris = new ArrayList(); 
        			String rid = ri.getRid();
        			for (RoleRight li : list){
                		Right right = rightmapper.selectByPrimaryKey(li.getRid());
                		System.out.println(right.getRname()+";;"+right.getPid() + ";;"+right.getRid());
        				if(rid.equals(right.getPid())){
        					ris.add(right);
        				}
        			}
        			map.put(ri.getRname(), ris);
        		}
        		
        		request.setAttribute("map", map);

jsp 页面用遍历循环



    ${go.count}

    ${item.key}

    

     ${i.rname}

    

 

你可能感兴趣的:(html)