-
Bug
-
Resolution: Fixed
-
Major
-
8.5.1.2
-
None
-
Security Level: Jimmy
-
None
-
ZK 8.5.2 S2
Steps to Reproduce
run fiddle with 8.5.1.2
http://zkfiddle.org/sample/br92rk/3-view-model-same-name-bleeding-in-include
Current Result
Page fails to render due to exception when processing databinding for the expression
<label value="@load(vm.stringValue)" />
Exception:
org.zkoss.zel.PropertyNotFoundException: Property 'stringValue' not found on type OuterVm
at org.zkoss.zel.BeanELResolver$BeanProperties.get(BeanELResolver.java:426)
at org.zkoss.zel.BeanELResolver$BeanProperties.access$300(BeanELResolver.java:376)
If 2 viewmodels are declared with the same variable. One of them is declared on a child of the component holding the original vm.
A binding for a method located inside the inner vm will be processed as if the variable was referring to the outer vm. (in this case, the getStringValue() method is located on the inner VM but the EL is resolved on the outerVM object).
(not sure if affected by <include> but couldn't reproduce after removing the include and consolidating in the same page)
Expected Result
before 8.5.1, this expression would correctly resolve on the innerVm getStringValue method
Debug Info
Start to happen after commit linked in comments
Root Cause
Workaround
Use a different name variable for the outer and inner vms