Hi,


I am interesting in writing components for editing domain objects. An example of such an object is Employee which has and Address and several other attributes. Also, I have Employer, which also has an Address. Now, if I want to create a component for an address that provide a part of the form, then I would like to be able to write it independent of whether it is the Employer's address or the Employee's address. In other words, I want to see an HTML template of the form:

     <tr> <td>Streeet:</td><td><input wicket:id="street" type="text"/></td></tr>
     .... other fields in a similar way...

In other words, I don't want to write wicket:id="address.street" because that would mean that the Address always has to be obtained from a model object using getAddress(). In other words, I would lose the ability to edit an address on its own or edit addresses that are retrieved by a different getter.

A first solution to solve this is to construct my own AddresPanel (extends Panel) with a reference to an Address object. The panel also creates its own CompoundPropertyModel based on the address. I tried this, and it works, but then again, back button support will be broken because when an old version of the page is requested, the CompoundPropertyModel of the Employer/Employee and Address will have different objects since they made their own copies.

It there a way in wicket 1 to share models? I was looking through the wicket 2 code and there seems to be something about shared models there. So what would be the wicket 1 way and what would be the wicket 2 way for doing this properly?

Cheers
  Erik

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to