Tobago Demo

Menu

JSR 303

Tobago has JSR 303 Validation support. With it, you can describe the validation in an annotation in the controller.

Required

In this example, the input cannot be empty - in other words, it's required. The value in the controller is annotated with @NotNull.

<tc:in label="Input" value="#{validationJsr303Controller.required}"/> @NotNull private String required;

Length

The length of the given string must be between 2 and 4 characters.

<tc:in label="Input" value="#{validationJsr303Controller.length}"/> @Size(min = 2, max = 4, message = "Length must be between 2 and 4") private String length;
© 2005-2023 Apache Software Foundation, Licensed under the Apache License, Version 2.0.