SpringMVC 接收对象参数

  1. <form action="">  
  2.     <input id="dbServerList[0].name" value="server1" />  
  3.     <input id="dbServerList[0].parent" value="abstractServer" />  
  4.       
  5.     <input id="dbServerList[0].factoryConfig.propertyList[0].name" value="valueipAddress"/>  
  6.     <input id="dbServerList[0].factoryConfig.propertyList[0].value" value="192.168.202.129"/>  
  7.       
  8.     <input id="dbServerList[0].factoryConfig.propertyList[1].name" value="user" />      
  9.     <input id="dbServerList[0].factoryConfig.propertyList[1].value" value="root" />  
  10.       
  11.     <input id="dbServerList[0].factoryConfig.propertyList[2].name" value="password" />      
  12.     <input id="dbServerList[0].factoryConfig.propertyList[2].value" value="xxxxxx" />  
  13.       
  14.     <input id="dbServerList[0].factoryConfig.propertyList[3].name" value="characterEncoding" />     
  15.     <input id="dbServerList[0].factoryConfig.propertyList[3].value" value="utf8" />  
  16.       
  17.     <input id="dbServerList[0].factoryConfig.propertyList[4].name" value="port" />      
  18.     <input id="dbServerList[0].factoryConfig.propertyList[4].value" value="3306" />  
  19.       
  20.     <input id="dbServerList[0].factoryConfig.propertyList[5].name" value="belongUsers" />   
  21.     <input id="dbServerList[0].factoryConfig.propertyList[5].value" value="'root','root1'" />  
  22.     <input id="dbServerList[1].name" value="server2" />  
  23.     <input id="dbServerList[1].parent" value="abstractServer" />  
  24.       
  25.     <input id="dbServerList[1].factoryConfig.propertyList[0].name" value="valueipAddress"/>  
  26.     <input id="dbServerList[1].factoryConfig.propertyList[0].value" value="192.168.202.129"/>  
  27.       
  28.     <input id="dbServerList[1].factoryConfig.propertyList[1].name" value="user" />      
  29.     <input id="dbServerList[1].factoryConfig.propertyList[1].value" value="root" />  
  30.       
  31.     <input id="dbServerList[1].factoryConfig.propertyList[2].name" value="password" />      
  32.     <input id="dbServerList[1].factoryConfig.propertyList[2].value" value="xxxxxx" />  
  33.       
  34.     <input id="dbServerList[1].factoryConfig.propertyList[3].name" value="characterEncoding" />     
  35.     <input id="dbServerList[1].factoryConfig.propertyList[3].value" value="utf8" />  
  36.       
  37.     <input id="dbServerList[1].factoryConfig.propertyList[4].name" value="port" />      
  38.     <input id="dbServerList[1].factoryConfig.propertyList[4].value" value="3306" />  
  39.       
  40.     <input id="dbServerList[1].factoryConfig.propertyList[5].name" value="belongUsers" />   
  41.     <input id="dbServerList[1].factoryConfig.propertyList[5].value" value="'root','root1'" />  
  42. </form>  


controller
  1. @RequestMapping(value="/dbservers", method=RequestMethod.PUT)  
  2. public ModelAndView updateDBServers(DBServers dbServers){  
  3.     boolean bol = dBServerService.updateDBServers(dbServers.getDbServerList());  
  4.     return new ModelAndView("test""a", bol);  
  5. }  
接收参数是DBServer 对象

DBServers   bean

  1. public class DBServers implements Serializable{  
  2.   
  3.     private String name;  
  4.   
  5.     private List<DBServer> dbServerList;  
  6.   
  7.     //set get  
  8. }  


DBServer  bean

  1. public class DBServer implements Serializable{  
  2.     private String name;  
  3.   
  4.     private String abstractive;  
  5.   
  6.     private String parent;  
  7.   
  8.     private String virtual;  
  9.   
  10.     private FactoryConfig factoryConfig;  
  11.   
  12.     private PoolConfig poolConfig;  
  13.   
  14.     //set get  
  15. }  

FactoryConfig  bean
  1. public class FactoryConfig implements Serializable {  
  2.   
  3.     private String clazz;  
  4.   
  5.     private List<Property> propertyList;  
  6. <span style="white-space:pre">  </span>//set get  
  7. }  


Property bean

  1. public class Property implements Serializable{  
  2.   
  3.     private String name;  
  4.       
  5.     private String value;  
  6.   
  7.     private Bean bean;  
  8.   
  9.     //set get  
  10. }  

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值