我是GWT的新手...我想在我的Web应用程序中实现会话基本上我希望会话从单击按钮(处理事件)开始,然后单击另一个按钮结束(其他处理事件) ).这是可能的?
怎么一步一步做?
这段代码好吗?:
主要(客户端):
Button b1 = new Button("b1");
b1.addClickHandler(new ClickHandler) {
public voin onClick(){
...
rpc.setSession(callback); //rpc call the service...
}
}
Button b2 = new Button("b2");
b1.addClickHandler(new ClickHandler) {
public voin onClick(){
...
rpc.exitSession(callback);
}
}
Run Code Online (Sandbox Code Playgroud)
// ------------------------------------------------ ------------------------------------
import com.google.gwt.user.client.rpc.RemoteService;
public interface MySession extends RemoteService {
public void setSession();
public void exitSession();
}
Run Code Online (Sandbox Code Playgroud)
// ------------------------------------------------ ------------------------------------
import com.google.gwt.user.client.rpc.AsyncCallback;
public interface MySessionAsync {
void setSession(AsyncCallback<Void> callback);
void exitSession(AsyncCallback<Void> callback);
}
Run Code Online (Sandbox Code Playgroud)
// ------------------------------------------------ ------------------------------------
import de.vogella.gwt.helloworld.client.MySession;
public class …Run Code Online (Sandbox Code Playgroud)