On Fri, Oct 22, 2010 at 11:38 AM, Sven Meier <s...@meiers.net> wrote:

> Hi Jan,
>
> when are data2 and data3 initialized? They seems to be null when you put up
> your models.
>
> Most of the time it's a bad idea to pull something out of a model and put
> it back into another model.
> Do this instead:
>
>    this.add(new MyPanel(id2, new PropertyModel(model, "data2")));
>
> Then in MyPanel:
>
>    public MyPanel(id, model){
>         super(id, new CompoundPropertyModel(model));
>
> This has the following advantages:
> - MyPanel's model is always in sync with the model of MyForm.
> - MyPanel's usage of CompoundPropertyModel is hidden from the outside. If
> MyPanel want's to utilize a CompoundPropertyModel (because it doesn't set
> the model on its contained components), it should set it up by itself.
>
> HTH
>
> Sven


Sven is spot-on, and this method he showed you above will absolutely save
you some bugs down the road!

Thanks Sven!!

-- 
Jeremy Thomerson
http://wickettraining.com
*Need a CMS for Wicket?  Use Brix! http://brixcms.org*

Reply via email to