formDoc.setEncoding(Encoding.MULTIPART);
formDoc.setTarget("fff");
form 里面记得写
formDoc.setTarget("fff");
这个是跳转iframe 的
HTMLPane htmlPane = new HTMLPane();
htmlPane.setContentsType(ContentsType.PAGE);
htmlPane
.setContents("<iframe name='fff' style='position:absolute;width:0;height:0;border:0'></iframe>");
htmlPane.setWidth("1");
htmlPane.setHeight("1");
final DynamicForm uploadForm = new DynamicForm();
uploadForm.setAction("uploadServlet");
uploadForm.setEncoding(Encoding.MULTIPART);
uploadForm.setMethod(FormMethod.POST);
uploadForm.setTarget("foo");
final UploadItem imageItem = new UploadItem("image","图片");
ButtonItem saveItem = new ButtonItem("save","上传");
saveItem.addClickHandler(new com.smartgwt.client.widgets.form.fields.events.ClickHandler() {
@Override
public void onClick(
com.smartgwt.client.widgets.form.fields.events.ClickEvent event) {
uploadForm.submitForm();
}
});