<% System.out.println("These indexed shall be shown on gui "+(ArrayList)request.getSession().getAttribute("selectedIndexes")); %> // ArrayList value can be 2,3,5,9
<s:iterator var="itr" value="#session.completeArrayList" status="stat">
<s:if > //if stat.count value present in arraylist(selectedIndexes), then go to if loop
</s:if
</s:iterator>
Run Code Online (Sandbox Code Playgroud)
我不知道如何在循环中检查%{#stat.count}
值。我该怎么做arraylist{selectedIndexes}
<s:if>
您是否尝试过 index 和 count 属性。这是显示示例的链接。
<s:iterator status="status" value='%{0, 1}'>
Index: <s:property value="%{#status.index}" /> <br />
Count: <s:property value="%{#status.count}" /> <br />
</s:iterator>
Run Code Online (Sandbox Code Playgroud)
将打印
索引:0 计数:1 索引:1 计数:2
Struts2使用OGNL并且它有in
运算符。所以你可以像这样轻松地检查它:
<s:iterator var="itr" value="#session.completeArrayList" status="stat">
<s:if test="#stat.count in #session.selectedIndexes">
</s:if
</s:iterator>
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
20079 次 |
最近记录: |