You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Lucio Crusca <lu...@sulweb.org> on 2013/03/18 22:23:00 UTC

CompoundPropertyModel binding direction

I'm trying to use CompoundPropertyModel in a form I dynamically create with a 
RepeatingView. I use the CompoundPropertyModel#bind method to bind each input 
tag to the corresponding java bean property.

Binding from java bean to html does work (the fields get filled), while the 
other way around (onSubmit) does break... the reported error is "no get method 
defined ... singlePanelForCurrentRow", where singlePanelForCurrentRow is the 
wicket:id I use to attach the repeating input tags.

I don't know what to search for on Google, because searching obvious terms 
(CompoundPropertyModel binding and the like) yelds trivial examples, but 
nothing similar to my needs.

Here is a quickstart demonstrating the issue, try clicking submit:

http://www.virtualbit.it/download/sparsi/example.zip

Thanks in advance
Lucio.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: CompoundPropertyModel binding direction

Posted by Sven Meier <sv...@meiers.net>.
>However I'm curious to know if a possible solution would be to create the
>DetailPage instance inside the onClick method of the Link, so that it becomes
>a local variable that gets collected asap.

Sure, that's perfectly fine.

Sven


On 03/19/2013 11:39 AM, Lucio Crusca wrote:
> In data Tuesday 19 March 2013 09:42:54, Sven Meier ha scritto:
>> Hi Lucio,
>> FormComponentPanels are an advanced concept and I'd recommend you extend
>> org.apache.wicket.markup.html.panel.Panel until you really need the
>> features of a FormComponentPanel.
> Thanks that solved the problem.
>
>> BTW your HomePage shouldn't keep a reference to another page (i.e.
>> DetailPage), since Wicket serialized pages separately.
> Well, to be honest I don't understand the full meaning of the sentence (why my
> design conflicts with Wicket serialization), but let's leave that to Google,
> I'll have a look.
>
> However I'm curious to know if a possible solution would be to create the
> DetailPage instance inside the onClick method of the Link, so that it becomes
> a local variable that gets collected asap.
>
>
>
> ---------------------------------------------------------------------
> 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


Re: CompoundPropertyModel binding direction

Posted by Lucio Crusca <lu...@sulweb.org>.
In data Tuesday 19 March 2013 09:42:54, Sven Meier ha scritto:
> Hi Lucio,

> FormComponentPanels are an advanced concept and I'd recommend you extend
> org.apache.wicket.markup.html.panel.Panel until you really need the
> features of a FormComponentPanel.

Thanks that solved the problem.

> BTW your HomePage shouldn't keep a reference to another page (i.e.
> DetailPage), since Wicket serialized pages separately.

Well, to be honest I don't understand the full meaning of the sentence (why my 
design conflicts with Wicket serialization), but let's leave that to Google, 
I'll have a look.

However I'm curious to know if a possible solution would be to create the 
DetailPage instance inside the onClick method of the Link, so that it becomes 
a local variable that gets collected asap.



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: CompoundPropertyModel binding direction

Posted by Sven Meier <sv...@meiers.net>.
Hi Lucio,

your LabelAndField and DetailFormComponentPanel both extend 
FormComponentPanel. Thus they will take part in form processing and try 
to push a value into their model.
Since there are no properties "singlePanelForCurrentRow" and 
"detailEditorPanel" the model update will fail.

FormComponentPanels are an advanced concept and I'd recommend you extend 
org.apache.wicket.markup.html.panel.Panel until you really need the 
features of a FormComponentPanel.

BTW your HomePage shouldn't keep a reference to another page (i.e. 
DetailPage), since Wicket serialized pages separately.

Hope this helps
Sven

On 03/18/2013 10:23 PM, Lucio Crusca wrote:
> I'm trying to use CompoundPropertyModel in a form I dynamically create with a
> RepeatingView. I use the CompoundPropertyModel#bind method to bind each input
> tag to the corresponding java bean property.
>
> Binding from java bean to html does work (the fields get filled), while the
> other way around (onSubmit) does break... the reported error is "no get method
> defined ... singlePanelForCurrentRow", where singlePanelForCurrentRow is the
> wicket:id I use to attach the repeating input tags.
>
> I don't know what to search for on Google, because searching obvious terms
> (CompoundPropertyModel binding and the like) yelds trivial examples, but
> nothing similar to my needs.
>
> Here is a quickstart demonstrating the issue, try clicking submit:
>
> http://www.virtualbit.it/download/sparsi/example.zip
>
> Thanks in advance
> Lucio.
>
> ---------------------------------------------------------------------
> 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