日期:2014-05-16 浏览次数:20430 次
如前端页面jsp中的标签为:
<form action="myurl"> <input type="checkbox" name="User.name" value="zhangsan">张三 <input type="checkbox" name="User.name" value="lisi">李四 </form>
在后台的User实体类
public class User{ String name; public String getName() { return name; } public void setName(String name) { this.name = name; } }
public User user; public User user; public User getUser() { return user; } public void setUser(User user) { this.user = user; }
如果在User类中定义个数组接收也可,情况是:
public class User{ String[] name; public String[] getName() { return name; } public void setName(String[] name) { this.name = name; } }在后台action(略去不表)接收的的值就是一个数组[zhangsan,lisi]