开发者

Sending response to the formpanel in gwt from servlet

I am calling servlet from the gwt client program开发者_如何学Go and setting

final FormPanel form = new FormPanel();
form.setMethod(FormPanel.METHOD_POST);
form.setEncoding(FormPanel.ENCODING_MULTIPART);
form.setAction(GWT.getModuleBaseURL()+"/uploadservlet2");

Now on submit complete I want to retrieve a parameter from the servlet in this event,

 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"));
      }
    });

Please tell me how I can do it.


in your onSubmitComplete:

public void onSubmitComplete(FormSubmitCompleteEvent event) {
String serverResponse = event.getResults();

}

you can let the server return HTML and put this in an HTML widget, or let the server return som JSON and parse this in GWT.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜