need help with indexed property

Hi,

Im using Struts 1.1 and im trying to code a small application for test indexed property.

I have a ValueObject "MyVO" with two fields.

I have a form bean "MyForm" defined in struts-config.xml

In the MyForm i have a reference to "MyVO".

class MyVO {

private public id;

private public name;

public MyVO() {

}

//GETTERS AND SETTERS

}

public class MyForm extends ActionForm {

private static final long serialVersionUID = 6979058420911788477L;

private MyVO myVO = null;

private MyForm[] lines = new MyForm[4];

//GETTERS AND SETTERS

}

Now i have jsp page:

<html:form type="MyForm" name="myForm" action="/something">

<input type="text" name="lines[0].id">

<input type="text" name="lines[0].name">

<input type="text" name="lines[1].id">

<input type="text" name="lines[1].name">

</html:form>

My target is give "N" objets (MyVO) to the action.

In this way doens't works. Is correct add a new field called "lines" in my case ?

I didn't understand if is need to define field lines or is possibile invoke some property. I tried indexed=true, but doesn't works.

Any suggets?

[1289 byte] By [davide.angela] at [2007-11-27 6:28:38]
# 1

I fixed adding this:

public MyForm getLines(int index) {

while (index >= this.lines.size())

this.lines.add(new MyForm());

return (MyForm)this.lines.get(index);

}

And chaning private MyForm[] lines = new MyForm[4] IN:

private ArrayList<MyForm> lines = new ArrayList<MyForm>();

thanks anyway.

davide.

davide.angela at 2007-7-12 17:52:05 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...