在JSP页面中显示ArrayList值

时间:2013-02-21 06:32:18

标签: jsp struts jsp-tags struts-1 struts-tags

我有这样的场景..

ArrayList<String> list1=new ArrayList<String>();
     list1.add("str1");
     list1.add("str2");
     list1.add("str3");

ArrayList<String> list2=new ArrayList<String>();
     list1.add("str1");
     list1.add("str2");
     list1.add("str3");
     .
     .// like this i have 10 lists
     .
    list10.


ArrayList<ArrayList<String>> AllLists=new  ArrayList<ArrayList<String>>();

    AllLists.add(list1);
    AllLists.add(list2);
      .
      .
    AllLists.add(list10);

in Struts Action Class 
   request.setAttribute("allLists",AllLists);

如何使用

在JSP页面中显示此Arraylist值

<logic:iterator> and <bean:write>标签给了我一些想法..

提前致谢...

1 个答案:

答案 0 :(得分:0)

<logic:notEmpty name="allLists" indexId="idx">
  <logic:iterate id="value" name="allLists">
    <bean:write name="value"/> or ${value} with index ${idx}.
  </logic:iterate>
</logic:notEmpty>