当前位置: 代码迷 >> Web前端 >> struts2 s:iterator取包孕LIST的MAP
  详细解决方案

struts2 s:iterator取包孕LIST的MAP

热度:138   发布时间:2012-09-17 12:06:52.0
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}"><img onclick="showYearMonthDiv(${yeargd.key})" src="${ctx}/style/skin1/images/max_gray.jpg" alt="展开" /></span><span id="closespan${yeargd.key}" style="display:none;"><img onclick="closeYearMonthDiv(${yeargd.key})" src="${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>

  相关解决方案