数据绑定-集合List绑定
users.html
1 <!DOCTYPE html> 2 <html> 3 4 <head> 5 <meta charset="UTF-8"> 6 <title></title> 7 </head> 8 9 <body> 10 <form action="/demo/show13.do" method="post"> 11 <div>用户1:</div> 12 <div> 13 <input name="users[0].name" value="zhangsan" /> 14 </div> 15 <div>用户2:</div> 16 <div> 17 <input name="users[1].name" value="lisi" /> 18 </div> 19 <div>用户3:</div> 20 <div> 21 <input name="users[2].name" value="wangwu" /> 22 </div> 23 <div> 24 <input type="submit" value="提交表单" /> 25 </div> 26 </form> 27 </body> 28 29 </html>
效果:
UserForm [users=[User [id=null, userName=null, password=null, name=zhangsan, age=null, sex=null, birthday=null, created=null, updated=null], User [id=null, userName=null, password=null, name=lisi, age=null, sex=null, birthday=null, created=null, updated=null], User [id=null, userName=null, password=null, name=wangwu, age=null, sex=null, birthday=null, created=null, updated=null]]]