我从gwt客户端程序调用servlet并设置
final FormPanel form = new FormPanel();
form.setMethod(FormPanel.METHOD_POST);
form.setEncoding(FormPanel.ENCODING_MULTIPART);
form.setAction(GWT.getModuleBaseURL()+"/uploadservlet2");
现在提交完成我想在这个事件中从servlet中检索一个参数,
form.addFormHandler(new FormHandler() {
public void onSubmit(FormSubmitEvent event) {
// This event is fired just before the form is submitted. We can take
// this opportunity to perform validation.
RootPanel.get().add(new Label("On submit"));
}
public void onSubmitComplete(FormSubmitCompleteEvent event) {
**///I want parameter here**
RootPanel.get().add(new Label("On submiting complete"));
}
});
请告诉我如何做到这一点。
答案 0 :(得分:2)
:
public void onSubmitComplete(FormSubmitCompleteEvent event) {
String serverResponse = event.getResults();
}
您可以让服务器返回HTML并将其放在HTML小部件中,或让服务器返回som JSON并在GWT中解析它。