OGNL语言和Struts2.0迭代标签,处理Map里嵌套Map的处理方法 1、Action的结构如下: package?com.ceno.mcps.cms.web.actions.contenttype; import?com.ceno.mcps.cms.ContentTypeManager; import?com.ceno.mcps.cms.model.ContentType; import?com.ceno.ejb.lookup.BeanLookup; import?java.util.Map; import?java.util.List; import?java.util.HashMap; import?java.util.ArrayList; public?class?ToAddContentTypeAction extends?ContentTypeAction { //定义JSP页面使用的List及Map;结构如下; private?List?list?=?new?ArrayList(); private?Map<Long,?Map<String,?Integer>>?map=new?HashMap<Long,?Map<String,?Integer>>(); public?String?execute() throws?Exception { ContentTypeManager?contentTypeManager?=?BeanLookup.getInstance().lookup( ContentTypeManager.class); contentTypes?=?contentTypeManager.getAllContentTypes(); list.add(((Integer)1).longValue()); list.add(((Integer)2).longValue()); Map<String,Integer>?temp1?=?new?HashMap<String,?Integer>(); temp1.put(“temp1.1″,3)?; temp1.put(“temp1.2″,4)?; Map<String,Integer>?temp2?=?new?HashMap<String,?Integer>(); temp2.put(“temp2.1″,5)?; temp2.put(“temp2.2″,6)?; map.put(list.get(0),?temp1); map.put(list.get(1),?temp2); return?SUCCESS; } public?List?getList() { return?list; } public?void?setList(List?list) { this.list?=?list; } public?Map?getMap() { return?map; } public?void?setMap(Map?map) { this.map?=?map; } } 2、JSP页面的定义如下: <s:iterator?value=”list”> <s:select?list=”map.get(longValue()).entrySet()”?listKey=”getKey()”?listValue=”getValue()”?name=”map1″ emptyOption=”true”/>