[
https://issues.apache.org/jira/browse/WICKET-4941?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13538968#comment-13538968
]
Andrew Geery commented on WICKET-4941:
--------------------------------------
The problem is on line 3754 of org.apache.wicket.Component.java. When getting
the model of the parent, the code calls
IModel<?> model = current.getModelImpl();
which does not initialize the parent's model.
There is a note in the code which says instead calling getDefaultModel() would
potentially cause lots of useless intermediate models to be created, but this
seems to be the only way to make CPM work correctly.
> Component.initModel() does not cause parent models to be initialized
> --------------------------------------------------------------------
>
> Key: WICKET-4941
> URL: https://issues.apache.org/jira/browse/WICKET-4941
> Project: Wicket
> Issue Type: Bug
> Components: wicket
> Affects Versions: 6.4.0
> Environment: All
> Reporter: Andrew Geery
> Priority: Minor
> Attachments: myproject.zip
>
>
> When using a nested CompoundPropertyModel, properties are not resolved
> against the correct model. One way to deal with this is to override the
> IModel<?> initModel() method. However, this method does not work unless
> getDefaultModel() has been called by the panel with the initModel() method
> before components are added. The issue is that initModel() does not call
> getDefaultModel() on the parent. This means that when trying to find the
> parent for resolving a CPM, the wrong CPM may be found because initModel()
> has not been called for the containing panel.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira