如何使用 Struts 2 标签迭代 Set 元素

2022-01-16 00:00:00 tags java jsp struts2 ognl

我有两个Sets

set1  contains("A","B","C","D") elements
set2  contains("E","F","D","G") elements

我想将 set1 的每个元素与 set2 的每个元素进行比较,并使用 Struts2 标签显示匹配的元素.

I want to compare every element of set1 with every element of set2 and display matched elements using Struts2 tags.

推荐答案

试试下面的代码:

<s:iterator var="val1" value="set1">
 <s:iterator var="val2" value="set2">
  <s:if test="#val1 == #val2">
   <s:property /><br>
  </s:if>
 </s:iterator>
</s:iterator>

相关文章