<% 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>
I dont know how to check %{#stat.count}
value in arraylist{selectedIndexes}
in <s:if>
loop.
How shall i do this
Have you tried index and count property yet. Here is the link that shows example.
<s:iterator status="status" value='%{0, 1}'>
Index: <s:property value="%{#status.index}" /> <br />
Count: <s:property value="%{#status.count}" /> <br />
</s:iterator>
will print
Index: 0 Count: 1 Index: 1 Count: 2
Struts2 uses OGNL and it has in
operator. So you can check it easily like that:
<s:iterator var="itr" value="#session.completeArrayList" status="stat">
<s:if test="#stat.count in #session.selectedIndexes">
</s:if
</s:iterator>
<s:iterator var="itr" value="#session.completeArrayList" status="stat">
<s:iterator var="ind" value="#session.selectedIndexes">
<s:if test="#stat.count == #ind">
I found #stat.count in selectedIndexes ArrayList
</s:if>
</s:iterator>
</s:iterator>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With