I’m trying create an application using Maven and Vaadin Bean Validation to validate my beans, but doesn’t now work to me.
I’m trying this.
/** person's bean */
@Entity
public class Person{
@Id
@GeneratedValue
private Integer id;
@NotNull
@NotEmpty
@Size(min=5, max=50, message="insert first name")
private String firstName;
@NotNull
@NotEmpty
@Email private String email;
}
//my app
public class LoginView extends VerticalLayout{
private TextField firstName, email;
private BeanFieldGroup<Person> binder;
private FormLayout form;
public LoginView(){
form = new FormLayout();
binder = new BeanFieldGroup<Person>(Person.class);
Field<?> field = null;
field = binder.buildAndBind("Firstname", "firstName");
firstName = (TextField)binder.getField("firstName");
form.addComponent(firstName);
field = binder.buildAndBind("Email", "email");
email = (TextField)binder.getField("email");
form.addComponent(email);
this.addComponent(form);
}
}
At maven I have added the dependencies as in image. How I do this work ??