lycwhite 发表于 2013-2-3 10:16:29

struts2 s:iterator取包含LIST的MAP

 
private Map<String, List<String>> yearMonthMap = new HashMap<String, List<String>>();
List<String> strList = Lists.newArrayList();
strList.add("01");
strList.add("02");
strList.add("03");
yearMonthMap.put("2011", strList);
yearMonthMap.put("2012", strList);
 
 

<s:iterator value="yearMonthMap" id="yeargd">
<div style="margin:5px 0;">
<div style="padding-left:5px;">
<span id="showspan${yeargd.key}"><imgsrc="${ctx}/style/skin1/images/max_gray.jpg" alt="展开" /></span><span id="closespan${yeargd.key}" style="display:none;"><imgsrc="${ctx}/style/skin1/images/min_gray.jpg" alt="关闭" /></span>
<span><a href="${ctx}/memo/memo.action?currYearMonth=${yeargd.key}-01"><s:property value="#yeargd.key"/>年归档</a></span>
</div>
<div id="yearmonthdiv${yeargd.key}" style="display:none;padding-left:20px;border:1px gray dashed;">
<s:iterator value="#yeargd.value" id="monthgd">
<div><a href="${ctx}/memo/memo.action?currYearMonth=${yeargd.key}-${monthgd}&ifMonth=yes"><s:property value="#yeargd.key"/>年<s:property value="monthgd"/>月</a></div>
</s:iterator>
</div>
</div>
</s:iterator>
页: [1]
查看完整版本: struts2 s:iterator取包含LIST的MAP