components can't have a default model because components that don't have a model will try to look this up to the parent to find a CompoundPropertyModel
such a model is then taken and shared over multiply components.
So you just have to make a choice, Give it a model of youre choice or let a find a CompoundPropertyModel from a parent:
private class SearchForm extends Form {
private TextField searchField = new TextField("searchField");
public SearchForm() {
super("searchForm", new CompoundPropertyModel());
add(searchField);
}
On 4/8/06,
Alexander Lohse <[EMAIL PROTECTED]> wrote:
Hi,
I wonder why components don't have a default model.
For instance the following code results in a Exception:
private class SearchForm extends Form {
private TextField searchField = new TextField("searchField");
public SearchForm() {
super("searchForm");
add(searchField);
}
protected void onSubmit() {
System.out.println(searchField.getValue ());
}
}
If I add:
searchField.setModel(new Model());
to the constructor, it works.
This is not really intuitive in my eyes.
Shall I post a feature request?
Regards,
Alex
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user
