API / Apache Wicket Interview questions
Explain the sequence of events when a Wicket Form is submitted?
A Wicket form submission runs through a defined sequence of validation and update phases before any of the form's own event-handling code executes, which is what lets Wicket guarantee that onSubmit() only ever runs against already-validated, already-updated model data.
Each submitted field is first converted from its raw string value to the component's typed model value, then validated individually by any attached IValidators; if any field fails, the whole process short-circuits and the page re-renders with error messages, never reaching the form's own onSubmit(). Only once every field passes does Wicket run the form-level onValidate() for cross-field checks, and only after that passes too does it call updateModel() on each component (writing the validated value into the backing object) before finally invoking onSubmit().
This ordering guarantees a developer's onSubmit() code never has to defensively re-check whether the data is valid — by the time it runs, every value has already passed both field-level and form-level validation and has already been written to the model.
More Related questions...