API / Apache Wicket Interview questions
What are the types of models Wicket provides out of the box?
Wicket ships several ready-made IModel implementations, each suited to a different way of getting at the underlying data.
| Model type | What it does |
| Model<T> | Simple wrapper around a single serializable value |
| PropertyModel<T> | Reads/writes a named bean property via reflection, e.g. "user.address.city" |
| CompoundPropertyModel<T> | Applies a PropertyModel automatically to every child component using its wicket:id as the property name |
| LoadableDetachableModel<T> | Loads its value on demand and detaches it afterward, avoiding session bloat |
| ListModel<T> | Wraps a List for use with repeating components |
Picking the right one is mostly about balancing convenience against control: CompoundPropertyModel saves a lot of repetitive wiring for a form bound closely to one object's fields, while LoadableDetachableModel is the one to reach for whenever the underlying data is expensive or large enough that keeping it resident in the session for the page's lifetime would be wasteful.
More Related questions...