如题:数据结构如下
Map<String, List<GatherMess>> sMap=new HashMap<String, List<GatherMess>>();
List<GatherMess> gList=new ArrayList<GatherMess>();GatherMess gatherMess=new GatherMess();gatherMess.setUserName("zhang");
gatherMess.setMessNum(2);
gList.add(gatherMess);gatherMess.setUserName("yang");
gatherMess.setMessNum(3);
gList.add(gatherMess);sMap.put("sannong", gList);
Map<String, List<GatherMess>> sMap=new HashMap<String, List<GatherMess>>();
List<GatherMess> gList=new ArrayList<GatherMess>();GatherMess gatherMess=new GatherMess();gatherMess.setUserName("zhang");
gatherMess.setMessNum(2);
gList.add(gatherMess);gatherMess.setUserName("yang");
gatherMess.setMessNum(3);
gList.add(gatherMess);sMap.put("sannong", gList);
<c:forEach items="${map}" var="m">
<c:forEach items="${m.list}" var="l">
//输出list的数据
</c:forEach>
</c:forEach>
<c:forEach items="${m.value}" var="l">
//输出list的数据
</c:forEach>
</c:forEach>
你这个方法也不对,页面上没有数据,后来发现是我少写了个value导致,还是谢谢了