Eelco,
Appreciate the quick follow up, so would it be OK to assume that every
page-component has to have a Model associated with it, either the model is
individually explicitly tagged with a component e.g. "add(new
RequiredTextField("dateOfBirth", new PropertyModel(person, "dateOfBirth")))"
OR it using the model configured for its parent (which lets say could be the
form or the page) via CompoundPropertyModel where you normally don't require
using the PropertyModel unless the need comes (as you commented, though i
have some question below on it)....Correct ?
Also on your comment on the usage of PropertyModels where you said "...when
you want to
use IDs that are different from the property expressions you want the model
to work on", i assume that you are refering to a scenario where you are
using a CompoundPropertyModel but you require the component to be populated
from a different source other than the model set for the parent..e.g.
add(new RequiredTextField ("login.userName"),new
PropertyModel(person,"username"));
Thanks again and REgards,
Farhan.
Eelco Hillenius wrote:
>
>>
>> Wouldn't the below two statements act exactly the same given i have a
>> person
>> object (which i would say both acts as a model as well as an object to
>> which
>> the form data is submitted) defined in a page.
>>
>> add(new RequiredTextField("person.userName"));
>> add(new RequiredTextField("person.userName"),new
>> PropertyModel(person,"username"));
>
> That is only true if you set a CompoundPropertyModel on the parent (or
> one of the parent's parents). Btw, you'd likely let the person be the
> subject of either the Propertymodel or CompoundPropertyModel.
>
>> If TRUE, the only reason i would want to have a PropertyModel (or in
>> other
>> words any type of Model) against a page-component would be the scenario
>> where the object i want to use as model is different from the one i would
>> use for data-submission...Correct..?
>
> Nope. Typical reasons to use PropertyModels explicitly is when you
> don't use a CompoundPropertyModel on the parent, or when you want to
> use IDs that are different from the property expressions you want the
> model to work on. Also, note that you can use completely different
> models as well; property models are convenient but not the only
> options (as you can read in the WIKI).
>
> Eelco
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
--
View this message in context:
http://www.nabble.com/Wicket-Model---A-very-simple-question-tf4668214.html#a13336961
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]