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 3970278
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T04:04:01+00:00 2026-05-20T04:04:01+00:00

Im pretty new to struts2, so Im trying to post everything you need to

  • 0

Im pretty new to struts2, so Im trying to post everything you need to understand my problem,Your help is much appreciated. try to be more clear, i’m in lack of ideas in this problem, even it sounds like a classic .

<s:checkbox name="selectedIndex" theme="simple" >
</s:checkbox>

I have dynamic number of checkboxes in my JSP.Lets say i have three checkbox in my jsp.Then if user select first and second checkbox then i want a array in action class whose element is {1,2}.If user select first and third checkbox then i want a array in action class whose element is {1,3}.How can i do it in struts2?

i have getter and setter in action class as:

public String[] getSelectedIndex() {
return selectedIndex;
}

public void setSelectedIndex(String[] selectedIndex) {
this.selectedIndex = selectedIndex;
}

so actionClass give me true and false.

In the followin code List1(Stored in session object) is list of StatusDTOs and getter,setter are following
element of StatusDTO is
:-

public boolean getIsDisabled()
{
return this.isDisabled;
}

public void setIsDisabled(boolean isDisabled)
{
this.isDisabled=isDisabled;
}

public int getSerialNo()
{
return this.serialNo;
}

public void setSerialNo(int serialNo)
{
this.serialNo=serialNo;
}

Actual code in jsp is

<%
ArrayList temp=(ArrayList)ActionContext.getContext().getSession().get("List1");
Iterator itr=temp.iterator();
while(itr.hasNext())
{
StatusDTO psd=(StatusDTO)itr.next();
System.out.println("********"+psd.getSerialNo());
%>
<tr>
<td bgcolor="#E6FAFB">
<%=psd.getSerialNo()%>
</td>
<td bgcolor="#E6FAFB">
<%
if(psd.getIsDisabled())
{
%>
<s:checkbox name="selectedIndex" theme="simple" disabled="true">
</s:checkbox>
<%
}
else
{
%>
<s:checkbox name="selectedIndex" theme="simple" value="1">
</s:checkbox>
<%}
%>

</td>
</tr>
<% }
%> 
  • 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-05-20T04:04:02+00:00Added an answer on May 20, 2026 at 4:04 am

    Staff Bean should have

    private boolean delete; /// with its setter and getter
    

    JSP

    <s:iterator name="staffList" status="bean_rowNum">
        <s:checkbox name="staffList[%{#request.attr.bean_rowNum-1}].delete" />
    </s:iterator>
    

    On submit you will get selected check box as a true

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

Sidebar

Related Questions

Am pretty new to ROR. Need help in Rails form validation. Am using rails
I pretty new to Objective-C (and C itself) and need to consume a NSData
I'm pretty new to WPF and using the MVVM design pattern. To help learn
Im pretty new to coding, heres my problem. Results->Text = G55 > Y +
I'm pretty new to c# and I'm trying to make a function that checks
Pretty new to dependency injection and I'm trying to figure out if this is
Pretty new to sqlite (and sql). Trying to modify one table using another. create
im pretty new in grails.. im having a little problem right now on validation
Im pretty new to jQuery (since a week) and don't understand why I can't
Pretty new to C# but not new in programming in generally. I'm still trying

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.