2011-06-21 36 views
2

我從GWT客戶端程序調用servlet和設置發送響應FormPanel中的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")); 
     } 
    }); 

請告訴我我該怎麼做。

回答

2

在onSubmitComplete:

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

} 

你可以讓服務器返回HTML,並把這個在HTML控件,或讓服務器返回索姆JSON和GWT解析此。