Why to set a model to a form?

2009-03-12 Thread Christian Helmbold
Hello, I wonder why I should set a model to a form, if every form field just holds a reference to the (same) model. Take a look at an example from Wicket in Action (page 91): public class MyForm extends Form { public MyForm(String id) { super(id); Customer customer = new Customer();

Re: Why to set a model to a form?

2009-03-12 Thread Jeremy Thomerson
A model decouples your form from where the object comes from. For instance, any time I create a form for adding an entity, I almost always use the same form for editing the entity. The form simply takes a IModelMyEntity and doesn't care if that is new ModelCustomer(new Customer()) or new