Niall Pemberton wrote the following on 10/13/2004 9:09 AM:

You should be able to do this in the indexed setter, something like this....

protected String[] myStringArray;

public void setMyString(int index, String myString) {

          // Allocate the array
          if  (myStringArray == null) {
               myStringArray = new String[index + 1];
          }

          // Grow the array
          if (index >= myStringArray.length) {
               String[] newMyStringArray = new String[index + 1];
               System.arraycopy(myStringArray, 0, newMyStringArray , 0,
myStringArray.length);
               myStringArray = newMyStringArray ;
          }

          // Set the indexed property
          myStringArray[index] = myString;

}

Thanks Niall.. that's what I was hoping to avoid having to code:)

Alternatively, just use a LazyValidatorForm and define the String[] as a
property in the struts-config and it will do this for you.

Ok, cool. I'll try that right now. Thanks a million.


-- Rick

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to