For clarity:

The ids of the form components only matters when you use a
CompoundPropertyModel, so might just as well have written the second
example like:

static class MyForm extends Form {

public MyForm(String id, Customer customer)  {
  super(id);
  add(new TextField("foo", new PropertyModel(customer, "name"));
  add(new TextField("bar", new
PropertyModel(customer, "address.streetName"));
}
}

or

static class MyForm extends Form {

public MyForm(String id, Customer customer)  {
  super(id);
  add(new TextField("foo", new PropertyModel(customer, "name"));
  add(new TextField("bar", new
PropertyModel(customer.getAddress(), "streetName"));
}
}

Eelco

On 5/26/06, Eelco Hillenius <[EMAIL PROTECTED]> wrote:
static class MyForm extends Form {

  public MyForm(String id, Customer customer)  { /* even better is to
have a model that produces your customer object */
    super(id);
    setModel(new CompoundPropertyModel(customer);
    add(new TextField("name"); // customer name
    add(new TextField("address.streetName"); // address' street name
  }
}

or

static class MyForm extends Form {

  public MyForm(String id, Customer customer)  {
    super(id);
    add(new TextField("name", new PropertyModel(customer, "name"));
    add(new TextField("address.streetName", new
PropertyModel(customer, "address.streetName"));
  }
}

Or whatever alternative you like.

Eelco

On 5/26/06, Florin Gheorghies <[EMAIL PROTECTED]> wrote:
>
> Customer {
>         String name;
>         Address address;
> }
>
> Address {
>         String streetName;
>         String zip;
> }
>
> I'd like to build a form that edits both the Customer.name and
> Custmer.address.streetName;
>
>
> Thanks.
>
>
>
> -------------------------------------------------------
> All the advantages of Linux Managed Hosting--Without the Cost and Risk!
> Fully trained technicians. The highest number of Red Hat certifications in
> the hosting industry. Fanatical Support. Click to learn more
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
> _______________________________________________
> Wicket-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>



-------------------------------------------------------
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to