Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8754365
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T13:36:11+00:00 2026-06-13T13:36:11+00:00

Is it possible to increment a variable in struts 2? I have a group

  • 0

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

enter image description here

//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>     

enter image description here
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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T13:36:13+00:00Added an answer on June 13, 2026 at 1:36 pm

    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:set line inside the <s:if, just for debugging, and ignoring the <s:hidden for now:

    <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}">
         <!-- Nothing here -->
         <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>
      <!-- Nothing here -->
    </s:iterator>     
    

    What do you see ?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: ++ operator in Scala I want to increment an Int variable in
Is it possible to have an auto-increment property but not an ID in JPA?
Is It Possible to have a primary key and auto increment key associated to
Is it possible in Matlab to increment a value of a variable without restating
I need a variable to increment a value in each click of the mouse
Is it possible to increment the badge value on receiving the notification. OR Should
Possible Duplicate: Post Increment and Pre Increment concept? I cant understand how the if
I am using Eclipse to develop a Blackberry Java application.Is possible to automatically increment
Possible Duplicate: Python: Behaviour of increment and decrement operators >>> a=2 >>> ++a 2
Is it possible to set the value of an auto-increment field? If a record

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.