Hello Martin & List,

Would it not be much more straightforward to just instantiate one of the
existing models, like
new FileUploadField("**UploadFileField", new Model<List<FileUpload>>()));
or some Model.of() variant ?


You mean Wicket automatically to do this for you ?

In current Wicket if a component has no model then its parent is asked.
If the parent's model
implements org.apache.wicket.model.IComponentInheritedModel then Wicket
asks it for a model for the child. This is how CompoundPropertyModel works.

If there is no IComponentInheritedModel up in the hierarchy then the
component just has model == null.

For your use case we can introduce Component#newDefaultModel() that can
return a sane default model per component. And this method should be called
only when org.apache.wicket.Component#initModel returns null.

I don't like much such automatic/automagic behaviors. I prefer to see an
exception message telling me what I forgot to do. But some people may like
this solution.

No, that would be too much.

How about making FileUpload Serializable ?
Then I could just Model.of(new FileUpload()) couldn't I ?


Cheers, Tom.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to