API / Apache Wicket Interview questions
What is the difference between IValidator and form-level validation in Wicket?
Both check user input before it's accepted, but they operate at different scopes: one field at a time versus the whole submitted form as a unit.
| IValidator | Form-level validation (Form.onValidate()) |
| Attached to a single FormComponent | Overridden on the Form itself |
| Checks one field's converted value in isolation | Checks relationships between multiple fields |
| Example: email format, string length, numeric range | Example: "password" and "confirm password" must match |
| Runs during each field's own validation phase | Runs after individual field validators have passed |
Both report problems the same way — through Wicket's feedback message system, typically rendered via a FeedbackPanel — so from the user's point of view the distinction is invisible; it only matters to the developer deciding where a particular rule naturally belongs: on the one field it concerns, or on the form as a whole when the rule spans more than one field.
More Related questions...