问题描述:
JSP页面的FORM表单对应ActionForm中的一个BEAN属性,而BEAN属性下面有一个对象数组对应页面中的某个栏目的多行数据,并且可以动态添加行。
经过试验,不知道为什么动态行中的数据总是提交不到ActionForm中,是不是我的代码有问题?!
以下是我的部分代码:
jsp:
<html>
<html:form action="...">
...
<nested:nest property="note">
...
<nested:iterate property="receps">
<nested:text property="num" indexed="true">
<nested:text property="sign" indexed="true">
</nested:iterate>
...
</nested:nest>
...
</html:form>
</html>
ActionForm:
public class OutForm extends ActionForm {
private Note note = new Note();
}
Note:
public class Note {
// 初始化数组是为了显示页面的时候有一个空白行
private Recep[] receps = new Recep[]{new Recep()};
}
Recep:
public calss Recep {
// 用来接收用户输入的值
private String num = null;
private String sign = null;
}