You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by mg...@apache.org on 2016/03/08 23:37:17 UTC

[36/52] [abbrv] wicket git commit: Update modelsforms_3.gdoc

Update modelsforms_3.gdoc

Wicket forms - CompoundPropertyModel - traversed components ID not taken into account when creating expression for evaluation of model property

The java code example used two variables with identical name and of different type, not only this would not compile, but the used name could potentially steer wicket beginners in wrong direction of thinking (regarding the matter of topic in this code snippet).

Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/c2b43357
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/c2b43357
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/c2b43357

Branch: refs/heads/lambdas
Commit: c2b433572d291d01209e908a7440165067b618d0
Parents: ad99443
Author: meno <am...@users.noreply.github.com>
Authored: Mon Mar 7 13:52:38 2016 +0100
Committer: meno <am...@users.noreply.github.com>
Committed: Mon Mar 7 13:52:38 2016 +0100

----------------------------------------------------------------------
 .../src/docs/guide/modelsforms/modelsforms_3.gdoc            | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/c2b43357/wicket-user-guide/src/docs/guide/modelsforms/modelsforms_3.gdoc
----------------------------------------------------------------------
diff --git a/wicket-user-guide/src/docs/guide/modelsforms/modelsforms_3.gdoc b/wicket-user-guide/src/docs/guide/modelsforms/modelsforms_3.gdoc
index 91baa8d..25c7840 100644
--- a/wicket-user-guide/src/docs/guide/modelsforms/modelsforms_3.gdoc
+++ b/wicket-user-guide/src/docs/guide/modelsforms/modelsforms_3.gdoc
@@ -174,12 +174,12 @@ Person spouse = new Person("Jill", "Smith");
 person.setSpouse(spouse);
 
 setDefaultModel(new CompoundPropertyModel(person));
-WebMarkupContainer spouse = new WebMarkupContainer("spouse");
+WebMarkupContainer spouseContainer = new WebMarkupContainer("spouse");
 Label name;
-spouse.add(name = new Label("name"));
+spouseContainer.add(name = new Label("name"));
 
-add(spouse);
+add(spouseContainer);
 {code}
 
 The value displayed by label "name" will be "John" and not the spouse's name  "Jill" as you may expect. In this example the label doesn't own a model, so it must search up its container hierarchy for an inheritable model. However, its container (WebMarkup Container with id 'spouse') doesn't own a model, hence the request for a model is forwarded to the parent container, which in this case is the page. In the end the label inherits CompoundPropertyModel from page but only its own id is used for the property expression. The containers in between are never taken into account for the final property expression.
-{note}
\ No newline at end of file
+{note}