用gwt制作ajax浏览器

 

把 上面的 改了

用gwt制作ajax浏览器

 

package  chenmin.client;

import  com.google.gwt.core.client.EntryPoint;
import  com.google.gwt.user.client.ui.Button;
import  com.google.gwt.user.client.ui.ClickListener;
import  com.google.gwt.user.client.ui.Label;
import  com.google.gwt.user.client.ui.RootPanel;
import  com.google.gwt.user.client.ui.Widget;
import  com.google.gwt.user.client.ui.TextBox;
import  com.google.gwt.user.client.HTTPRequest;
import  com.google.gwt.user.client.ResponseTextHandler;
/**
 * Entry point classes define <code>onModuleLoad()</code>.
 
*/

public   class  Http  implements  EntryPoint  {

  
/**
   * This is the entry point method.
   
*/

  
public void onModuleLoad() {
    
final Button button = new Button("Click me");
    
final Label label = new Label();
    
final TextBox url = new TextBox();
    
    button.addClickListener(
new ClickListener() {
        
public void onClick(Widget sender) {
                    HTTPRequest.asyncPost(url.getText(),
nullnew ResponseTextHandler() {

                    
public void onCompletion(String responseText) {
                        
// TODO Auto-generated method stub
                        label.setText(responseText);
                        
// xmlFile=responseText;

                    }


                }
);
            }

        }

    );
    
    
// Assume that the host HTML has elements defined whose
    
// IDs are "slot1", "slot2".  In a real app, you probably would not want
    
// to hard-code IDs.  Instead, you could, for example, search for all 
    
// elements with a particular CSS class and replace them with widgets.
    
//
    RootPanel.get("slot1").add(url);
    RootPanel.get(
"slot2").add(button);
    RootPanel.get().add(label);
  }

}

 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值