struts多层表单提交的问题
scope="request"jsp<logic:iterate id="bean1" name="form" property="list1" indexId="i"><logic:iterate id="bean2" name="bean1" property="list2" indexId="i"><html:text  xxxxxxxxxxxxxxxxxxxx></logic:iterate >
</logic:iterate >
form的结构private List<Bean1> list1= new ArrayList<Bean1>();除了get,set,追加方法
public Bean1 getBean1(int index){while(list1.size()<=index){
list1.add(new Bean1());
}
return list1.get(index);
}
Bean1的结构private List<Bean2> list2= new ArrayList<Bean2>();除了get,set,追加方法
public Bean2 getBean2(int index){while(list2.size()<=index){
list2.add(new Bean2());
}
return list2.get(index);
}
画面submit以后,form里面 list1被提交,但是list2丢失,
getBean2这个方法怎么写才能够让list2提交?

解决方案 »

  1.   

    更正一下
    <logic:iterate id="bean1" name="form" property="list1" indexId="i"><logic:iterate id="bean2" name="bean1" property="list2" indexId="j">   <-----笔误,是j<html:text xxxxxxxxxxxxxxxxxxxx></logic:iterate >
    </logic:iterate >
      

  2.   

    <logic:iterate id="bean2" name="bean1" property="list2" indexId="j"> 这层循环里面解析出来的形式是<input type="text" name="bean2[0].propery1" value="123">
    <input type="text" name="bean2[1].propery2" value="123">
    <input type="text" name="bean2[2].propery3" value="123">