tags:

views:

932

answers:

1

So in struts I have an action form which has 5 properties. Each property is a String Array.

in my form class i getter/setter methods for the properties like the ones below:

public String getPropertyX(int index) {
  return x[index];
}

public void setPropertyX(int index, String value) {
  x[index] = value; 
}

When my form is first processed I populate the form object and when it displays the respective JSP i can tinker with it so it outputs the correct values using the struts tags and get the propper values for each array. However, I want those to be inputs so when i submit the form the object/arrays will be populated for me. However on submitting the form I get a "Error 500: No getter method for property." When I add the following to my form object I no longer get that error:

public String getPropertyX() {
   return x;
}

I no longer get that error, but now then it comes to a population error on the backend when i process the form. I could do it another way but I'd much rather use the struts framework (i'm learning here).

A: 

Figured it out on my own. Decided to go a whole different way. Created two ActionForms (not really sure if the second one needed to be an ActionForm but it works). One contains the actual elements in the form I want to populate on each row of the form. The other contains an Array of the other. I iterate through the array on the jsp and using indexed="true" on the inputs I achieve what i want.