java - Vaadin Form Validation with BeanFieldGroup -
in book of vaadin read following:
validating bean done beanvalidator, initialize name of bean property should validate , add the editor field. validation done after focus leaves field. bean validators automatically created when using beanfieldgroup.
so here's beanfieldgroup:
beanfieldgroup<ordersearchcriteria> binder = new beanfieldgroup<>(ordersearchcriteria.class); binder.setitemdatasource(searchcriteria);
and how i've added validation on bean:
@min(0) private bigdecimal minamount; @min(0) private bigdecimal maxamount; @pattern(regexp = "([a-za-z]+@[a-za-z]+.[a-za-z]{2,})?") private string email;
validation not automatically added thought would. missing?
you need download implementation of bean validator, , things start working out of box.
if you're using maven , want use hibernate-validator add dependency in pom.xml file this:
<dependency> <groupid>org.hibernate</groupid> <artifactid>hibernate-validator</artifactid> <version>5.0.0.final</version> </dependency>
references:
- hibernate validator: http://hibernate.org/validator/
- versions available in maven: http://mvnrepository.com/artifact/org.hibernate/hibernate-validator
Comments
Post a Comment