NutzCN Logo
短点 自己看的,不用回
发布于 3350天前 作者 qq_6c5a7e9a 1779 次浏览 复制 上一个帖子 下一个帖子
标签:

JSP

<form action="test" method="post" enctype="multipart/form-data">
		<input name="user.name" value="胡涛"></br>
		<input name="user.age" value="23"></br>
		<input name="user.birthday" value="1991-01-06"></br>
		<input name="user.sex" value="true"></br>
		<input name="user.children[sb].name" value="女儿"></br>
		<input name="user.children[sb].age" value="13"></br>
		<input name="user.children[cnm].name" value="儿子"></br>
		<input name="user.children[cnm].age" value="12"></br></br>
		
		<input name="children[sb].name" value="老大"></br>
		<input name="children[sb].age" value="17"></br>
		<input name="children[cnm].name" value="老二"></br>
		<input name="children[cnm].age" value="18"></br>
		<input name="children[nsn].name" value="老三"></br>
		<input name="children[nsn].age" value="19"></br></br>
		
		<input name="cnmlgb" type="file"></br>
		<input name="cnmlgb" type="file"></br>
		<input name="cnmlgb" type="file"></br>
		
		<input type="submit">
	</form>

入口方法

@AdaptBy(type = UploadAdaptor2.class, args = { "${app.root}/WEB-INF/tmp" })
	public String 好傻逼(@Param("::user.") User userp, @Param("::children") ArrayList<Child> children, @Param("cnmlgb") TempFile[] files) throws IOException {
		for (TempFile file : files) {
			file.getMeta().getFileLocalName();
			FileOutputStream streamO = new FileOutputStream("D://"+file.getMeta().getFileLocalName());
			FileInputStream streamI = new FileInputStream(file.getFile());
			for (int i = streamI.read(); i != -1; i = streamI.read())
				streamO.write(i);
			streamI.close();
			streamO.close();
		}

		System.out.println(files.length);
		System.out.println(Json.toJson(userp));
		System.out.println(Json.toJson(children));
		return "哈哈";
	}

输出

3
{
   "name" :"胡涛",
   "age" :23,
   "birthday" :"1991-01-06 00:00:00",
   "sex" :true,
   "children" :[{
      "name" :"女儿",
      "age" :13
   }, {
      "name" :"儿子",
      "age" :12
   }]
}
[{
   "name" :"老三",
   "age" :19
}, {
   "name" :"老大",
   "age" :17
}, {
   "name" :"老二",
   "age" :18
}]

文件

QQ截图20151022114855_png

添加回复
请先登陆
回到顶部