ActionForm嵌套对象数组

 public class TestForm extends ActionForm {
    private String address;
    private String method;
    private TestSubForm[] subTest;
                ..........................
}
public class TestSubForm extends ActionForm {
    private String id;
    private String name ;
    private String value;
                ........................
}

有两个存在这种嵌套关系的数组,TestSubForm[] 数组大小不确定。

jsp页面如下:

<input name="address" type="text" value="">

     <input name="name" type="text" value="">
     <input name="value" type="text" value="">


     <input name="name" type="text" value="">
     <input name="value" type="text" value="">


     <input name="name" type="text" value="">
     <input name="value" type="text" value="">

在action中怎么才能直接TestForm 对象,并且可以遍历TestSubForm数组


问题补充:
假如按 zhai puhong的方法把

private TestSubForm[] subTest;

改为

private list subTest;

那么在action处理类中

public class ValuationAction extends DispatchAction {

public ActionForward list(......){

TestForm testForm = new TestForm();


testForm = (TestForm)form;

if(testForm!=null){

List subFormList = testForm.getSubTest();

}

return mapping.findForward("list");

}

}

好像subFormList是空的 并不是我希望的TestSubForm集合

在AppFuse 中ssh就有form套用form的例子
[code="java"]
public class UserForm
extends BaseForm
implements java.io.Serializable
{

……
protected AddressForm address = new AddressForm();

……
[/code]

[size=medium]你是怎么配form的啊?
怎么这么乱啊?
在说,好像没有用form套用form的吧

action中取得form
在action的[/size]
[code="java"]public ActionForward execute(ActionForm form , ActionMapping mapping , HttpServletRequest request , HttpServletResponse response){
你配置的form类型 _form = (你配置的form类型)form;
之后用 _form.getString("属性");就是你要的东西啦
}[/code]



/logic:iterate

楼主试试看,我没有测试过。如果
[code="java"]private TestSubForm[] subTest;[/code]

改成

[code="java"]private list subTest;[/code]

上面的方法是可行的,我在项目中一直是这么用的。

强烈建议换用struts2作为MVC框架!