实体模型,主要问题是LIST中的元素还有一个list
Class one{
int id;
List<send> s;
}Class send{
int id;
class1 otherClass1;
List<third> t;
}Class third{
int id;
class2 otherClass2;
}在网页中要把以上三个类的数据都输入,用一个action接收,actionForm怎么建,数据收集代码怎么写
Class one{
int id;
List<send> s;
}Class send{
int id;
class1 otherClass1;
List<third> t;
}Class third{
int id;
class2 otherClass2;
}在网页中要把以上三个类的数据都输入,用一个action接收,actionForm怎么建,数据收集代码怎么写
import org.apache.struts.action.ActionForm;
public class TestForm extends ActionForm { private One one = new One(); // 这里必须初始化
private Second second = new Second();
private Third third = new Third();
// List 的话你要用String[] all 接收,再转化成List
String[] one_s;
String[] second_t;
// 其它类的属性接收
// 比如otherClass1的属性name,在这个Form中不用定义
}
jsp中这样定义接收名称
<input type="text" name="one.id" /><input type="text" name="second.id" />
<input type="text" name="second.otherClass1.name" />
..............