Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The corresponding input field in the html must have a wicket id of "address.city". This works, but it does expose the internal structure of the model data in the html. CompoundPropertyModel has a method that can be used to rectify this.

BoundCompoundPropertyModel adds three new methods. They associate a child component of the model with a specific property expression and/or type conversionThe model associates a different property expression with the component being bound.

Code Block
public <S> IModel<S> bind(String property)

...

Code Block
CompoundPropertyModel personModel = new CompoundPropertyModel(person);
Form personForm = new Form("aPersonForm", personModel);
TextField cityField = new RequiredTextField("city");
personForm.add(cityField);
, personModel.bind(cityField, "address.city"));
personForm.add(cityField);

Also, note that if you are using a component that you do not want to reference the compound property model, but is a child of the form, that you define a model for that component. For example:

...