Validation
Validations play a crucial role by enforcing business rules before the system updates data in the model or acts upon it. webforJ integrates validations directly into the data binding process, providing a seamless way to ensure data integrity as it flows between UI components and the backend.
Topics
📄️ Validators
Validators checks data within your UI components against defined constraints before committing this data to the data model. You can apply validators to ensure that data meets certain criteria, such as being within a specified range, matching a pattern, or not being empty.
📄️ Reporters
Validation reporters are used for providing feedback about the validation process to the user interface. This feature is essential for informing users about the results of their input validation, particularly in complex forms or data-intensive applications.
📄️ Context Results
When you write data from the UI to the model, the write method of the BindingContext triggers the validations. The validation results determine whether the data is acceptable.
📄️ Triggers
By default, bindings automatically revalidate components when users modify their data, such as entering new text, checking a checkbox, or selecting a new option in a radio button. If you prefer to turn off automatic validations and only report them when writing to the data model, you can configure the binding to turn them off. This gives you control over when and how validations occur, allowing you to manage validations according to specific app needs or user interactions.
📄️ Jakarta Validation
Java Bean Validation is widely recognized as the standard for integrating validation logic into Java applications. It utilizes a uniform approach to validation by allowing developers to annotate domain model properties with declarative validation constraints. These constraints are enforced at runtime, with options for both built-in and custom-defined rules.