SpringMVC 接收对象参数

jsp

<form action="">
	<input id="dbServerList[0].name" value="server1" />
	<input id="dbServerList[0].parent" value="abstractServer" />
	
	<input id="dbServerList[0].factoryConfig.propertyList[0].name" value="valueipAddress"/>
	<input id="dbServerList[0].factoryConfig.propertyList[0].value" value="192.168.202.129"/>
	
	<input id="dbServerList[0].factoryConfig.propertyList[1].name" value="user" />	
	<input id="dbServerList[0].factoryConfig.propertyList[1].value" value="root" />
	
	<input id="dbServerList[0].factoryConfig.propertyList[2].name" value="password" />	
	<input id="dbServerList[0].factoryConfig.propertyList[2].value" value="xxxxxx" />
	
	<input id="dbServerList[0].factoryConfig.propertyList[3].name" value="characterEncoding" />	
	<input id="dbServerList[0].factoryConfig.propertyList[3].value" value="utf8" />
	
	<input id="dbServerList[0].factoryConfig.propertyList[4].name" value="port" />	
	<input id="dbServerList[0].factoryConfig.propertyList[4].value" value="3306" />
	
	<input id="dbServerList[0].factoryConfig.propertyList[5].name" value="belongUsers" />	
	<input id="dbServerList[0].factoryConfig.propertyList[5].value" value="'root','root1'" />
	<input id="dbServerList[1].name" value="server2" />
	<input id="dbServerList[1].parent" value="abstractServer" />
	
	<input id="dbServerList[1].factoryConfig.propertyList[0].name" value="valueipAddress"/>
	<input id="dbServerList[1].factoryConfig.propertyList[0].value" value="192.168.202.129"/>
	
	<input id="dbServerList[1].factoryConfig.propertyList[1].name" value="user" />	
	<input id="dbServerList[1].factoryConfig.propertyList[1].value" value="root" />
	
	<input id="dbServerList[1].factoryConfig.propertyList[2].name" value="password" />	
	<input id="dbServerList[1].factoryConfig.propertyList[2].value" value="xxxxxx" />
	
	<input id="dbServerList[1].factoryConfig.propertyList[3].name" value="characterEncoding" />	
	<input id="dbServerList[1].factoryConfig.propertyList[3].value" value="utf8" />
	
	<input id="dbServerList[1].factoryConfig.propertyList[4].name" value="port" />	
	<input id="dbServerList[1].factoryConfig.propertyList[4].value" value="3306" />
	
	<input id="dbServerList[1].factoryConfig.propertyList[5].name" value="belongUsers" />	
	<input id="dbServerList[1].factoryConfig.propertyList[5].value" value="'root','root1'" />
</form>


 controller 

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

DBServers   bean

public class DBServers implements Serializable{

	private String name;

	private List<DBServer> dbServerList;

	//set get
}


DBServer  bean

public class DBServer implements Serializable{
	private String name;

	private String abstractive;

	private String parent;

	private String virtual;

	private FactoryConfig factoryConfig;

	private PoolConfig poolConfig;

	//set get
}

FactoryConfig  bean
public class FactoryConfig implements Serializable {

	private String clazz;

	private List<Property> propertyList;
	//set get
}


Property bean

public class Property implements Serializable{

	private String name;
	
	private String value;

	private Bean bean;

	//set get
}


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值