Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Format checked and unchecked examples

...

Validator

Constraint Type

Description

Example

email

Ensures that the given input looks like a valid e-mail address

<t:textfield value="userEmail" validate="email" />

max

long

Enforces a maximum integer value

<t:textfield value="age" validate="max=120,min=0" />

maxLength

int

Makes sure that a string value has a maximum length

<t:textfield value="zip" validate="maxlength=7" />

min

long

Enforces a minimum integer value

<t:textfield value="age" validate="max=120,min=0" />

minLength

int

Makes sure that a string value has a minimum length

<t:textfield value="somefield" validate="minlength=1" />

none

Does nothing (used to override a @Validate annotation)

<t:textfield value="somefield" validate="none" />

regexp

pattern

Makes sure that a string value conforms to a given pattern

<t:textfield value="letterfield" validate="regexp=^[A-Za-z]+$" />

required

Makes sure that a string value is not null and not the empty string

<t:textfield value="name" validate="required" />

checked (Since 5.4.5)booleanMakes sure that the boolean is true (checkbox is checked)<t:Checkbox value="value" validate="checked" />
unchecked (Since 5.4.5)booleanMakes sure that the boolean is false (checkbox is unchecked)<t:Checkbox value="value" validate="unchecked" />

Centralizing Validation with @Validate

...