我在获取来自FormPanel的字段的值时遇到了问题。我得到的唯一东西是表单中包含的图像,这里是servlet代码,我使用的是Apache Commons:
// Create a new file upload handler
ServletFileUpload upload1 = new ServletFileUpload();
// Parse the request
FileItemIterator iter;
try {
iter = upload1.getItemIterator(req);
while (iter.hasNext()) {
FileItemStream item = iter.next();
String name = item.getFieldName();
InputStream stream = item.openStream();
if (item.isFormField()) {
System.out.println("Form field " + name + " with value "
+ Streams.asString(stream) + " detected.");
} else {
System.out.println("File field " + name + " with file name "
+ item.getName() + " detected.");
// Process the input stream
}
}
} catch (FileUploadException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}我看过this post,但它并没有真正解释该怎么做
发布于 2013-05-02 03:46:22
就像@Colin Alworth所说的,必须为每个字段设置name属性!
TextBox lastName = new TextBox();
lastName.setName("LastName");https://stackoverflow.com/questions/16320850
复制相似问题