> First of all what is really the use case of this:
>
> add(new TextFiedl("id"));
>
> IF we did new Model() in the constructor?
> Because how would you get the data back from that text field?
> Are you going to keep references to that textfield and then ask when a form
> submits its data?
> That doesn't seems to much sense to me.

Are you refering to this?

Person p = new Person();
setModel(new Model(p);
add(new TextField("name", new PropertyModel(p, "name"));

setModel wouldn't be necesarry, except that you might use it in
onSubmit. But the above example works read/write okay. It uses the
property name of that given object to read from or write to.

> I think you don't find much code for formcomponentst that does this:
> new TextField("id", new Model()); because it really doesn't make much sense
> you want the data to go to somewhere where you can read it.

Yeah, that's why the above example sets the person model on the form,
so that in onSubmit, you can get the current value.

> And you are right easy things easy. And that is just the way it works now
> almost all larger apps use CompoundModels because that is so easy to use and
> not so verbose.

It's easy to use when you understand what happens. I don't think it is
easy to understand for new users though. And the fact that we get
questions about it now and then proves that.

However, *when* you understand how it works, it is really nice because
it is a code saver, and you don't have to carry your model object
around as much. So I like the functionality, but maybe we should use
it in all our examples but start out with simple models first.

Eelco


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid3432&bid#0486&dat1642
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to