Hi Alpine Bluster, look at this code:
public void onModuleLoad() { this.setLoginPanel(); loginButton = new Button("Login"); loginButton.addListener(new ButtonListenerAdapter() { public void onClick(Button button, EventObject e) { userAuthentication(); } }); formPanel.addButton(loginButton); formPanel.setBorder(false); loginPanel.add(formPanel); Element appPanelEl = loginPanel.getElement(); @SuppressWarnings("unused") KeyMap map = new KeyMap(appPanelEl, new KeyMapConfig() { { setKey(EventObject.ENTER); setKeyListener(new KeyListener() { public void onKey(int key, EventObject e) { loginButton.focus(); } }); } }); RootPanel.get("login_widget").add(loginPanel); } private void userAuthentication() { if (this.userNameField.getValueAsString().equals("")) Window.alert("username must not be empty."); else { loginService = GWT.create(LoginService.class); String username = this.userNameField.getValueAsString(); String password = this.passwordField.getValueAsString(); this.loginService.login(username, password, new AsyncCallback<LoginResponse>() { public void onFailure(Throwable caught) { Window.alert("server side failure: " + caught); } public void onSuccess(LoginResponse result) { if (result.isLoginSuccess()){ Window.Location.replace("./../Main.html"); } else Window.alert("username or password invalid."); } }); } } ... FOR LOGOUT .... private Panel northPanel = new Panel(); .... Toolbar toolbar = new Toolbar(); ToolbarButton logoutButton = new ToolbarButton("Sign Out"); logoutButton.addListener( new ButtonListenerAdapter() { public void onClick( Button button, EventObject e ) { LoginServiceAsync service = GWT.create(LoginService.class); service.logout(new AsyncCallback<Void>() { @Override public void onFailure(Throwable caught) { caught.printStackTrace(); } @Override public void onSuccess(Void result) { Window.Location.replace("./../Login.html"); } }); } }); tabPanel = new TabPanel(); toolbar.addFill(); toolbar.addText("welcome," + someUser..); toolbar.addSeparator(); toolbar.addButton(logoutButton); tabPanel.setWidth(NORMALIZE_SPACING); tabPanel.setTopToolbar(toolbar); northPanel.add(tabPanel); On Wed, Jun 2, 2010 at 5:25 PM, Magnus <alpineblas...@googlemail.com> wrote: > Hi, > > I cannot find a minimalistic example that shows how to realize a login/ > logout functionality. > Could please someone point me to such an example? > > I also wonder where to put the different things. For example, the code > that immediately reacts on the "login" button could be placed within > the "client" folder of a GWT project, or it could be realized as a > servlet. > > When do I use a servlet and how? > > Thank you! > Magnus > > -- > You received this message because you are subscribed to the Google Groups > "Google Web Toolkit" group. > To post to this group, send email to google-web-tool...@googlegroups.com. > To unsubscribe from this group, send email to > google-web-toolkit+unsubscr...@googlegroups.com<google-web-toolkit%2bunsubscr...@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/google-web-toolkit?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.