Struts 多行提交及操作
UserInfo bean 相关属性
public class UserInfo{
private String username;
private String password;
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
}
单个的UserInfo
public class UserInfoForm extends ActionForm {
private static final long serialVersionUID = 1L;
private String username;
private String password;
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
}
多个的UserInfo
public class UserInfoListForm extends ActionForm{
private static final long serialVersionUID = 5049729273082639532L;
private List users=new AutoArrayList(UserInfoForm.class);
public List getUsers() {
return users;
}
public void setUsers(List users) {
this.users = users;
}
}
public class AutoArrayList extends ArrayList{
private static final long serialVersionUID = 7329071318112930773L;
private Class itemClass;
public AutoArrayList(Class itemClass) {
this.itemClass = itemClass;
}
public Object get(int index) {
try {
while (index > = size()) {
add( itemClass.newInstance());
}
} catch (Exception e) {
e.printStackTrace();
}
return super.get(index);
}
}
添加操作的JSP页面
<html:form action= "/userInfo ">
用户名1: <