Is it possible to increment a variable in struts 2?
I have a group of check boxes, each checkbox comes under different group. And I name the check boxes based on the group id and its own id from the database

//namesHead : list contains all the group Ids and names
//subHead : list contains all the subgroups id,Name and the reference of main group
<s:iterator status="status" value="namesHead">
<input type="checkbox" onclick="selectSimilarSubGroup('<s:property value="%{id}" />')" />Select All
<s:set name="itrVar" value="1"></s:set>
<s:iterator status="status1" value="subHead" >
<s:set name="var1" value="%{refer_id}"></s:set>
<s:set name="var2" value="%{id}"></s:set>
<s:if test="%{#var1==#var2}">
<s:set name="itrVar" value="%{#status1.count}"></s:set>
<input type="checkbox" multiple id="chk_grp<s:property value="%{id}"/>_<s:property value="%{#status1.count}" />" name="chk_grp" value="<s:property value="%{id_grp}"/>" />
<s:property value="%{name_grp}"/>
</s:if>
</s:iterator>
<s:hidden name="grp_count_%{id}" value="%{#itrVar}" />
</s:iterator>

I think its because the iterator is skipping the initial counts in the second loop. How can i modify the code to get that expected output. Or is there any way to increment a variable inside the page itself?
Mmm… sub-iterator status should reset on every iteration of the parent iterator, with both “two separate lists” or “a list inside another list”…
Something is messing up the counter. Try removing the
<s:setline inside the<s:if, just for debugging, and ignoring the<s:hiddenfor now:What do you see ?