Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jsp/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ruby-on-rails-3/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何使用Struts嵌套标记库从HashSet字段属性中获取项?_Java_Jsp_Arraylist_Struts_Hashset - Fatal编程技术网

Java 如何使用Struts嵌套标记库从HashSet字段属性中获取项?

Java 如何使用Struts嵌套标记库从HashSet字段属性中获取项?,java,jsp,arraylist,struts,hashset,Java,Jsp,Arraylist,Struts,Hashset,我试图使用Struts嵌套标记遍历ArrayList和Set集合对象。我已经附上了我的代码片段 <snested:iterate property="productsList" id="aProduct"> <snested:iterate property="participantList" id="participant_item"> ...... <snested:text property="firstName" styleCl

我试图使用Struts嵌套标记遍历
ArrayList
Set
集合对象。我已经附上了我的代码片段

<snested:iterate property="productsList" id="aProduct">
   <snested:iterate property="participantList" id="participant_item">
       ......
     <snested:text property="firstName" styleClass="text"/>
  </snested:iterate>
</snested:iterate>
但是如果我使用
List
而不是
Set
集合,它就可以正常工作

该类不是索引集合。不能将此类与Struts嵌套标记一起使用


如果必须使用
Set
而不是
List
,则应更改使用此标记的标记或标记库,或使用另一个标记库,即JSTL等。

对象类型是什么?ArrayList productsList;类产品有一个名为Set participantList的属性,firstName是ParticipantInfo ClassIs的属性。有没有方法使用struts嵌套的taglib在LinkedHashSet上迭代?没有,但您可以尝试解决方案。
Invalid argument looking up property: "productsList[0].participantList[0].firstName" of bean: "orderedProducts"
at org.apache.struts.taglib.TagUtils.lookup(TagUtils.java:887
at org.apache.struts.taglib.html.BaseFieldTag.prepareValue(BaseFieldTag.java:126)