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/07 14:43:45 UTC

wicket git commit: Update modelsforms_3.gdoc

Repository: wicket
Updated Branches:
  refs/heads/wicket-7.x f96bdfca3 -> e85a72fac


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/e85a72fa
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/e85a72fa
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/e85a72fa

Branch: refs/heads/wicket-7.x
Commit: e85a72faca5115bdb5c2e0c122cfa86d6e41f635
Parents: f96bdfc
Author: meno <am...@users.noreply.github.com>
Authored: Mon Mar 7 13:52:38 2016 +0100
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Mon Mar 7 14:43:36 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/e85a72fa/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}