April 2018
Intermediate to advanced
202 pages
4h 48m
English
Vaadin comes with a LoginForm class that, by default, renders a username and a password field. It also adds auto-completion and auto-fill in the browser. The LoginForm class is a good candidate for extension (and you have to extend it if you want to override its defaults). For example, the following snippet of code creates a loginForm and a listener that is invoked when the user clicks the login button:
LoginForm loginForm = new LoginForm()
loginForm.addLoginListener(e -> {
String password = e.getLoginParameter("password");
String username = e.getLoginParameter("username");
...
});
To add more fields to the form, override the createContent method. For example:
LoginForm loginForm = new LoginForm() { @Override protected ...Read now
Unlock full access