reuse panel with fields across multiple forms in wicket, posible?
-
25-09-2019 - |
Question
i have the following classes :
class Address
{
String street; String street2; String number;
/*.....other fields, getters and setters*/
}
class Person
{
/*person specific fields*/
Address address;
}
class User
{
/* user specific fields */
Person owner;
}
and i need to make 2 forms one for Person
and one for User
, since im using wicket, it seems logical that i could make an AddressFieldsPanel
with all the fields of an address and use that panel inside PersonForm
and UserForm
markup but, wich model should i use to be able to bind the address fields to the address
property of the Person
class and also to the owner.address
of the User
class, is this posible in wicket?
Solution
You might want to try making a FormComponentPanel
. I don't know a good public example for this, but there are definitely uses of it in wicket-datetime, and you can get the source for that here.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow