just do this in youre example:
[Form Code]
Form myform = new Form("myform", new CompoundPropertyModel(new Data()));
TextField txt = new TextField("myprop");
myform.add(txt);
[/Form Code]
myprop id is automaticaly mapped to youre model property myprop
johan
On 2/18/06, Ayodeji Aladejebi <
[EMAIL PROTECTED]> wrote:
Hello,Just another small suggestion as regarding future Java5 directions of Wicket.I know Wicket generally may not be planning to use annotations but i just want to know the limitations of having stuff like this in some future Wicket version especially in the FormBindingToModel Situations.Lets say we have a plan to build a Model-Form relationship, presently what we basically do is:[HTML]<form wicket:id="myform"><input wicket:id="myprop" type="text"><input wicket:id="submit" type="submit" /></form>[/HTML][Model]class Data {private String myprop;...}[/Model][Form Code]final Data mydata = new Data();Form myform = new Form("myform");TextField txt = new TextField("myprop",new PropertyModel(mydata, "myprop");myform.add(txt);[/Form Code]But in the annotation stuff, how about this approach:[Model]class Data {//something of this sort@bind(id="myprop") //where id here from HTML side means wicket:id="myprop"private String myprop;...}[/Model]and then when creating the form, we can say something like:[Form Code]Form myform = new Form("myform", new AnnotatedModel(Data.class));[/Form Code]when the form is very long, this can be useful in reducing effort and the wicket wont have to worry about whether its a TextField or a TextArea, it can simply determine that from the HTML code: <input wicket:id="myprop" type="text" />so that all users do is design the model and allows Wicket to do the binding magic to the form. You know something a little close to Introspection in JSP, On a basic level, Is this useful really?Thanks
-- Loving this Wicket Life...--
"The more life's risk you take, the more life's reward you get" - Me
Aladejebi Ayodeji A.,
PentaSoft Technologies Limited
