el表达式解析Map嵌套取值

List<Map<String, Object>> combinelist = new ArrayList<Map<String, Object>>();
Map<String, Object> newmap;
for(Map<String, Object> map:plantdlist){
	newmap = new HashMap<String,Object>();
	newmap.put("scdtime", map.get("scdtime").toString());
	newmap.put("inflow", map.get("inflow").toString());
	for(String tdmc:planthlist){
		newmap.put(tdmc, combine(tdmc,map.get("scdtime").toString(),planinfolist));
		break;
	}
	combinelist.add(newmap);
}

private Map<String, Object> combine(String tdmc,String scdtime,List<Map<String, Object>> planinfolist){
Map<String, Object> nmap = new HashMap<String,Object>();
for(Map<String, Object> tdmap:planinfolist){
	if(tdmc.equals(tdmap.get("famc").toString()) && scdtime.equals(tdmap.get("scdtime").toString())){
		System.out.println(tdmap.get("scdtime").toString()+"--"+tdmap.get("famc").toString());
		nmap.put("letout", tdmap.get("letout").toString());
		nmap.put("waterlv", tdmap.get("waterlv").toString());
		nmap.put("storml", tdmap.get("storml").toString());
		break;
	}
}
return nmap;
}

    jsp端:

   

<s:iterator var="map"  value="#request.combinelist" status="st">
<tr>
<td align="center">${map.scdtime }&nbsp;<!-- 时间 --></td> 
<td align="center">${map.inflow }&nbsp;<!-- 入流 --></td> 
<s:iterator var="tdmc"  value="#request.planthlist" status="st">   
<s:iterator value="${map[tdmc]}" status="st" var="lData">     
<td align="center">&nbsp;
${lData}
</td>
</s:iterator>
</s:iterator>
</tr>
</s:iterator>

 
 

 

你可能感兴趣的:(el表达式)