Struts2中iterator标签遍历map总结 收藏
Struts2中iterator标签遍历map总结
针对以下几种情况的Map:
private Map map;
private Map studentMap;
private Map arrayMap;
private Map> listMap;
--------------------------------------------------------------------------------
map=new HashMap();
map.put("1", "one");
map.put("2", "two");
用法:
key:
value:
--------------------------------------------------------------------------------
studentMap=new HashMap();
studentMap.put("student1",new Student(new Long(1),"[1**********]","张三1","男",25));
studentMap.put("student2",new Student(new Long(2),"[1**********]","张三2","女",26));
studentMap.put("student3",new Student(new Long(3),"[1**********]","张三3","男",27));
用法:
--------------------------------------------------------------------------------
arrayMap=new HashMap();
arrayMap.put("arr1", new String[]{"1","2003401","leejie","male","20"});
arrayMap.put("arr2", new String[]{"2","2003402","huanglie","male","25"});
arrayMap.put("arr3", new String[]{"3","2003403","lixiaoning","male","21"});
用法
--------------------------------------------------------------------------------
listMap=new HashMap>();
List list1=new ArrayList();
list1.add(new Student(new Long(1),"[1**********]","张三1","男",25));
list1.add(new Student(new Long(2),"[1**********]","张三2","男",25));
list1.add(new Student(new Long(3),"[1**********]","张三3","男",25));
listMap.put("class1", list1);
List list2=new ArrayList();
list2.add(new Student(new Long(1),"[1**********]","李四1","男",20));
list2.add(new Student(new Long(2),"[1**********]","李四2","男",21));
list2.add(new Student(new Long(3),"[1**********]","李四3","男",22));
list2.add(new Student(new Long(4),"[1**********]","李四4","男",23));
listMap.put("class2", list2);
用法:
Struts2中iterator标签遍历map总结 收藏
Struts2中iterator标签遍历map总结
针对以下几种情况的Map:
private Map map;
private Map studentMap;
private Map arrayMap;
private Map> listMap;
--------------------------------------------------------------------------------
map=new HashMap();
map.put("1", "one");
map.put("2", "two");
用法:
key:
value:
--------------------------------------------------------------------------------
studentMap=new HashMap();
studentMap.put("student1",new Student(new Long(1),"[1**********]","张三1","男",25));
studentMap.put("student2",new Student(new Long(2),"[1**********]","张三2","女",26));
studentMap.put("student3",new Student(new Long(3),"[1**********]","张三3","男",27));
用法:
--------------------------------------------------------------------------------
arrayMap=new HashMap();
arrayMap.put("arr1", new String[]{"1","2003401","leejie","male","20"});
arrayMap.put("arr2", new String[]{"2","2003402","huanglie","male","25"});
arrayMap.put("arr3", new String[]{"3","2003403","lixiaoning","male","21"});
用法
--------------------------------------------------------------------------------
listMap=new HashMap>();
List list1=new ArrayList();
list1.add(new Student(new Long(1),"[1**********]","张三1","男",25));
list1.add(new Student(new Long(2),"[1**********]","张三2","男",25));
list1.add(new Student(new Long(3),"[1**********]","张三3","男",25));
listMap.put("class1", list1);
List list2=new ArrayList();
list2.add(new Student(new Long(1),"[1**********]","李四1","男",20));
list2.add(new Student(new Long(2),"[1**********]","李四2","男",21));
list2.add(new Student(new Long(3),"[1**********]","李四3","男",22));
list2.add(new Student(new Long(4),"[1**********]","李四4","男",23));
listMap.put("class2", list2);
用法: