【发布时间】:2012-12-09 14:23:15
【问题描述】:
@POST
@Path("post")
@Consumes("multipart/form-data")
public Response postCategory(@FormDataParam("text1") String text1,
@FormDataParam("file1") InputStream file1,
@FormDataParam("text2") String text2,
@FormDataParam("file2") InputStream file2) {
System.out.println("CategoryService.postCategory()");
System.out.println("text1:" + text1);
System.out.println("text2:" + text2);
String uploadedFileLocation = "d://uploaded/test.jpg";
writeToFile(file1, uploadedFileLocation);
return Response.ok().build();
}
使用此代码,我可以将 HtmlInputFile 作为 InputStream,将 HtmlInputText 作为 String,但我想获得HtmlInputText 的另一个属性,例如id, name, class 甚至更多:我的动态属性如下:
<input type='text' myattr='myattr-value' name='inpp'/>
【问题讨论】:
标签: java web-services forms post jersey