Tobago has JSR 303 Validation support. With it, you can describe the validation in an annotation in the controller.
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;
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;