2010年10月20日星期三

GWT POST 提交页面


GWT  POST 提交页面


将所有参数以&分隔放入builder.setRequestData中

01 RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, BASIC_URL);
02 builder.setHeader("Content-Type","application/x-www-form-urlencoded; charset=utf-8");
03 builder.setRequestData("chartSWF=" + be.getSelectedItem().getType() + ".swf&chartId=" + be.getSelectedItem().getType() + "&strXML=" + generateXml(entry));
04 builder.setCallback(new RequestCallback(){
05      public void onError(Request request, Throwable exception) {  
06          chart.removeAll();chart.addText("出错啦");
07      }
08      public void onResponseReceived(Request request, Response response) {
09      if(200 == response.getStatusCode()){
10          chart.removeAll();
11          chart.addText(response.getText());
12          chart.layout();
13      }else{
14          chart.removeAll();chart.addText("出错啦");
15      }
16      }
17 });
18    
19      try {
20      builder.send();
21 } catch (RequestException e) {
22     e.printStackTrace();
23 }


参考:http://blog.csdn.net/leoyunfei/archive/2008/12/26/3611565.aspx

没有评论:

发表评论