You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by pieter claassen <pi...@claassen.co.uk> on 2009/03/15 21:39:49 UTC
setModel() and getModel() questions
I am obviously doing something wrong here.
On my wicket pages, I am trying to set the Model with setModel()
e.g. setModel(new CompoundPropertyModel(new Treatment()));
On the components (forms, panels etc.) contained on that page, I try
to retrieve the object with getModelObject() or getInnermostModel()
but both of them return null.
eg. Treatment treatment = (Treatment) getModelObject();
The other components still function correctly in the form so they
manage to access the model properties using the CompoundPropertyModel.
What is the difference between getModelObject() and
getInnermostModel().getObject()?
Anybody have a tip on what I am doing wrong here?
Thanks,
Pieter
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: setModel() and getModel() questions
Posted by Igor Vaynberg <ig...@gmail.com>.
make sure you are not calling these methods in the constructors -
before the components are added to the page that has the model.
-igor
On Sun, Mar 15, 2009 at 1:39 PM, pieter claassen <pi...@claassen.co.uk> wrote:
> I am obviously doing something wrong here.
>
> On my wicket pages, I am trying to set the Model with setModel()
>
> e.g. setModel(new CompoundPropertyModel(new Treatment()));
>
> On the components (forms, panels etc.) contained on that page, I try
> to retrieve the object with getModelObject() or getInnermostModel()
> but both of them return null.
>
> eg. Treatment treatment = (Treatment) getModelObject();
>
> The other components still function correctly in the form so they
> manage to access the model properties using the CompoundPropertyModel.
>
> What is the difference between getModelObject() and
> getInnermostModel().getObject()?
>
> Anybody have a tip on what I am doing wrong here?
>
> Thanks,
> Pieter
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org