小编lhu*_*ang的帖子

Gwt rpc AsyncCallbak之后的代码是不会被执行的?

我无法理解为什么gwt rpc AsyncCallback之后的代码不会被执行?

例如,我有接口AppService扩展RemoteService,所以我将有AsyncAppService进行异步调用.

以下代码

            AppServiceAsync service = GWT.create (AppService.class);
        service.getCurrentUser(new AsyncCallback<Employee>(){

            public void onFailure(Throwable caught) {

            }

            public void onSuccess(Employee result) {
                currentUser = result;
            }

        });
 // if i have the code after the above call, these code will not be execute, what is the problem
//code following will not be executed if they are in the same function.
    boolean isAdmin = false;
        if(currentUser!=null){
            if(currentUser.getUserRole().equals("ROLE_ADMIN") ||
                    currentUser.getUserRole().equals("ROLE_MANAGER")){
                isAdmin = true;
            }
        }
Run Code Online (Sandbox Code Playgroud)

谢谢你的解释

gwt rpc

1
推荐指数
1
解决办法
639
查看次数

标签 统计

gwt ×1

rpc ×1