springmvc: Binding request parameter set type

A request for a parameter-based binding entity

domain:

1     private String username;
2     private String password;
3     private Double money;
4 
5     private User user;

1     <%--把数据封装到Account类中--%>
2     <form action="param/saveAccount" method="post">
3         姓名:<input type="text" name="username"/><br>
4         密码:<input type="password" name="password"/><br>
5         金额:<input type="text" name="money"/><br>
6         用户姓名:<input type="text" name="user.name"/><br>
7         用户年龄:<input type="text" name="user.age"/><br>
8         <input type="submit" value="提交">
9     </form>

 

 Second, the request parameter binding set of type List, Map

domain:

1     private String username;
2     private String password;
3     private Double money;
4 
5     private List<User> list;
6     private Map<String,User> map;

1      <% - the encapsulated data to the Account class list, and map the presence of the collection classes -%>
 2      <form Action = "param / saveAccount" Method = "POST">
 . 3      Name: <input type = "text" = name "username" /> <br>
 4      password: <the INPUT of the type = "password" name = "password" /> <br>
 5      amount: <input type = "text"
 name = "money" /> <br> 6      user name: <INPUT type = "text" name = "List [0] .name" /> <br>
 . 7      Age: <input type = "text" name = "list [0] .age" /> < br>
 . 8  
. 9      user name: <input type = "text"
 name = "map [ 'one'] name." /> <br>10     用户年龄:<input type="text" name="map['one'].age"/><br>
11     <input type="submit" value="提交">
12     </form>

 

Guess you like

Origin www.cnblogs.com/flypig666/p/11516782.html
Recommended