package com.sample.myProject.client;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.rpc.ServiceDefTarget;
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;
/**
* This class is used to demostrate hwo to
* interact with the server client in asynchronized
* way
*/
public class DemoClient implements EntryPoint {
public void onModuleLoad() {
final SampleServiceAsync sampleService = (SampleServiceAsync) GWT.create(SampleService.class);
ServiceDefTarget target = (ServiceDefTarget) sampleService;
String staticResponseURL = GWT.getModuleBaseURL();
staticResponseURL += "/getStringService";
target.setServiceEntryPoint(staticResponseURL);
final Label label = new Label();
final Button button = new Button("Get String");
button.addClickListener(new ClickListener() {
public void onClick(Widget sender) {
sampleService.getString(new AsyncCallback() {
public void onSuccess(Object result) {
label.setText((String) result);
}
public void onFailure(Throwable caught) {
label.setText(caught.getMessage());
}
});
}
});
RootPanel.get("1").add(button);
RootPanel.get("2").add(label);
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
资源详情
资源评论
资源推荐
收起资源包目录
GWTSample_Project.rar (15个子文件)
GWTSample_Project
GWTSample
.project 409B
bin
com
sample
myProject
server
SampleServiceImpl.class 542B
client
SampleServiceAsync.class 217B
DemoClient$1.class 1KB
DemoClient$2.class 1KB
DemoClient.class 2KB
SampleService.class 230B
GWTSample-shell.cmd 200B
GWTSample-compile.cmd 178B
src
com
sample
myProject
server
SampleServiceImpl.java 331B
client
SampleServiceAsync.java 186B
DemoClient.java 2KB
SampleService.java 244B
GWTSample.launch 2KB
.classpath 368B
共 15 条
- 1
zhaopeng_xf
- 粉丝: 0
- 资源: 14
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0