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

  • Home
  • SEARCH
  • 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 399005
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T16:48:14+00:00 2026-05-12T16:48:14+00:00

Currently I am working on one form which contains 2 buttons. Clicking on 1

  • 0

Currently I am working on one form which contains 2 buttons. Clicking on 1 button I am getting block of html fields as below.

`

<table width="100%">
    <tbody><tr>

      <td class="style4" width="12%" align="center">CODE<span class="style3"> </span></td>
      <td width="18%"><input name="c_code[]" value="" id="c_code__" class="box_border" style="width: 120px;" type="text"></td>
      <td class="style3" width="15%" align="right">Price</td>
      <td width="7%"><input name="c_price[]" value="" id="c_price__" class="box_border" style="width: 40px;" type="text"></td>
      <td class="style3" width="4%" align="right">Qty</td>
      <td width="7%"><input name="c_qty[]" value="" id="c_qty__" class="box_border" style="width: 40px;" type="text"></td>
      <td class="style3" width="9%" align="right">On Sale </td>

      <td width="3%"><input name="c_onsale[]" id="c_onsale__" value="" type="radio">    
<label for="c_onsale"></label>
</td>
      <td class="style3" width="10%" align="center">Exposition</td>
      <td width="15%"><input name="c_exposition[]" size="15" value="" id="c_exposition__" class="box_border" type="text"></td>
    </tr>
  </tbody></table>

`

Now each time user clicks on button whole block given above will be included in html form using ajax method call.

  1. Now my problem is how can I get values of all elements as an array in struts2 action class.
    Or How to write setter and getter method for these arrays.

Is there any better way to perform above in other way which make work easier for me?

  1. How to write struts2 validation file for array fields like this?

Can anyone help me in this matter.

Thanks.

  • 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-12T16:48:15+00:00Added an answer on May 12, 2026 at 4:48 pm

    Ok, if you can rename your fields using an index in the array for each iteration, so they’ll be named c_name[0], c_name[1], etc… Then you can just define an array in your action class and the mapping will be done without problems.
    As for validation I would suggest a server-side validation on your action.

    Regards,

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

Sidebar

Related Questions

Currently I'm working on a textbook ordering html form with PHP User shown a
I'm using Rails 3.2, Carrierwave and simple_form. Currently, everything is working fine with one
I am currently working on a project where one of our goals is to
I'm currently working on a project with a one page design that'll slide up
I am currently working on a module that takes one of our business objects
I'm currently working on implementing a fulltext search engine for one of our sites,
I am currently working on a page that has a date picker for one
I am currently working on 2 web servers, One Coldfusion and the other PHP.
In one of the ASP .Net site we are currently working we have a
I'm currently working on an ASP.NET web-site. In one of my pages, I had

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.