Created
July 24, 2012 03:32
-
-
Save deepaksinghvi/3167849 to your computer and use it in GitHub Desktop.
callServerSerivce
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Button btnAdd = new Button("Add"); | |
btnAdd.addClickHandler(new ClickHandler() { | |
public void onClick(ClickEvent event) { | |
User user = new User(); | |
user.setUserName(nameTextBox.getText()); | |
user.setPassword(passwordTextBox.getText()); | |
MongoDBServiceAsync mongoDBServiceAsync = GWT | |
.create(MongoDBService.class); | |
ServiceDefTarget serviceDef = (ServiceDefTarget) mongoDBServiceAsync; | |
serviceDef.setServiceEntryPoint(GWT.getModuleBaseURL() | |
+ "dbservice"); | |
mongoDBServiceAsync.setUser(user, new AsyncCallback<Void>(){ | |
@Override | |
public void onFailure(Throwable caught) { | |
Window.alert("User addition failed, reason: " +caught.getMessage()); | |
} | |
@Override | |
public void onSuccess(Void result) { | |
Window.alert("User addition successful"); | |
} | |
}); | |
} | |
}); | |
btnAdd.setText("Add Users"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment