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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T14:12:23+00:00 2026-06-18T14:12:23+00:00

I’m using Apache Struts 1.3 to render a grid, whitch is a html form

  • 0

I’m using Apache Struts 1.3 to render a grid, whitch is a html form embebed in a .jsp. Something like

<html:form action="/MyController.do?action=processForm">
<html:text property="taxation[0][0]" value="" styleClass="gridInputs"></html:text>
<html:text property="taxation[0][1]" value="" styleClass="gridInputs"></html:text>
 ...
<html:text property="taxation[10][10]" value="" styleClass="gridInputs"></html:text>

MyController is associated to an ActionForm:

public class MyForm extends ActionForm{

protected String taxation[][]= new String [10][10]; 

public String[] getTaxation() {
    return taxation;
}

public void setTaxation(String[][] taxation) {
    this.taxation = taxation;
}

The problem arise when I try to retrieve the information submitted by the form. Whithin MyController.class I’ve a simple dispatcher action

public class MyController extends DispatchAction {
public ActionForward processForm(ActionMapping mapping, ActionForm form,
        HttpServletRequest request, HttpServletResponse response) {

    MyForm myform = (MyForm) form;

            // Here i can use the getter method to retrieve an array, but
           // myform is already wrong populated from struts


    }


    return mapping.findForward("stage2");

}

I know I can use a Vector (unidimensional array) and It works just fine, but regrettably I need to follow some specs (and the specs force me to use the class MyForm with a 10×10 matrix…). How would be the right way to populated a two dimensional array using struts?

Thank you for the help!

  • 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-18T14:12:24+00:00Added an answer on June 18, 2026 at 2:12 pm

    Struts does not support filling of multidimensional array in Form bean. However, it does handle uni-dimensional array of an object. So as a work around if you can create a class (say MatrixRow) which itself contains an Uni-dimensional array and then you can create an Uni-dimensional array of that object in the form bean. Your new class will be look like

        public class MatrixRow {
    
        private String matrixCol[] = new String[10];
    
        /**
         * @return the matrixCol
         */
        public String[] getMatrixCol() {
            return matrixCol;
        }
    
        /**
         * @param matrixCol the matrixCol to set
         */
        public void setMatrixCol(String[] matrixCol) {
            this.matrixCol = matrixCol;
        }
    }
    

    Then in your form bean

    private MatrixRow[] arrMatrix = new MatrixRow[10];
    /**
         * @return the arrMatrix
         */
        public MatrixRow[] getArrMatrix() {
            return arrMatrix;
        }
    
        /**
         * @param arrMatrix the arrMatrix to set
         */
        public void setArrMatrix(MatrixRow[] arrMatrix) {
            this.arrMatrix = arrMatrix;
        }
    

    and In your JSP, you can use it something like

        <html:form action="biArrayTestAction.do">
        <table cellpadding="0" cellspacing="0" width="100%">
        <logic:iterate id="matrixRows" name="biArrayTestForm" 
                       property="arrMatrix" indexId="sno" 
                       type="logic.MatrixRow" >
        <tr>
            <td><bean:write name="sno"/></td>
        <logic:iterate id="matrixCol" name="matrixRows" property="matrixCol" indexId = "colNo">
            <td>
               <input type="text" name="arrMatrix[<%=sno %>].matrixCol[<%=colNo %>]">
            </td>
        </logic:iterate>
        </tr>
        </logic:iterate>
        <tr>
          <td align="center" valign="top" colspan="2">
            &nbsp;
          </td>
        </tr>
        <tr>
            <td align="center" valign="top" colspan="2">
              <html:submit property="command" value="Test"></html:submit>
            </td>
        </tr>
       </table>
    

    When you submit that form you will get all columns of MatrixRow object filled with the values.

    I hope this will help you. I don’t find any other way of using multidimensional array in Struts1.

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

Sidebar

Related Questions

I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to render a haml file in a javascript response like so:
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I have thousands of HTML files to process using Groovy/Java and I need to
I would like my Web page http://www.gmarks.org/math_in_e-mail.txt on my Apache 2.2.14 server to display
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am using JSon response to parse title,date content and thumbnail images and place
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I am trying to find ID3V2 tags from MP3 file using jid3lib in Java.

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.