语言和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
private?Map
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
temp1.put(“temp1.1″,3)?;
temp1.put(“temp1.2″,4)?;
Map
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
{
return?list;
}
public?void?setList(List
{
this.list?=?list;
}
public?Map?getMap()
{
return?map;
}
public?void?setMap(Map?map)
{
this.map?=?map;
}
}
2、JSP页面的定义如下: