Uploaded image for project: 'ZK'
  1. ZK
  2. ZK-3831

initViewModel fails during createComponents on detached parent

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: 8.0.4.2, 8.5.0
    • Fix Version/s: 8.5.1
    • Component/s: Databind 2
    • Security Level: Jimmy
    • Labels:
      None

      Description

      Steps to Reproduce

      run the attached example
      vminit-aftercompose.zul

      Current Result

      Exception:

      org.zkoss.zk.ui.UiException: can't find Page to resolve a view model class :'MyVm' at [file:/D:/workspace/projects_idea/support/zksupport8/src/main/webapp/potential/5193-vminit-aftercompose/mvvminc.zul, line:7, nearby column: 43]
      	at org.zkoss.bind.BindComposer.initViewModel(BindComposer.java:254)
      	at org.zkoss.bind.BindComposer.doBeforeComposeChildren(BindComposer.java:150)
      	at org.zkoss.zk.ui.impl.UiEngineImpl.doBeforeComposeChildren(UiEngineImpl.java:997)
      	at org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild0(UiEngineImpl.java:937)
      	at org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild(UiEngineImpl.java:895)
      	at org.zkoss.zk.ui.impl.UiEngineImpl.execCreate0(UiEngineImpl.java:777)
      	at org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild(UiEngineImpl.java:842)
      	at org.zkoss.zk.ui.impl.UiEngineImpl.execCreate0(UiEngineImpl.java:797)
      	at org.zkoss.zk.ui.impl.UiEngineImpl.execCreate(UiEngineImpl.java:740)
      	at org.zkoss.zk.ui.impl.UiEngineImpl.createComponents(UiEngineImpl.java:1150)
      	at org.zkoss.zk.ui.impl.AbstractExecution.createComponents0(AbstractExecution.java:346)
      	at org.zkoss.zk.ui.impl.AbstractExecution.createComponents(AbstractExecution.java:307)
      	at org.zkoss.zk.ui.Executions.createComponents(Executions.java:176)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:498)
      	at bsh.Reflect.invokeMethod(Reflect.java:131)
      	at bsh.Reflect.invokeStaticMethod(Reflect.java:95)
      	at bsh.Name.invokeMethod(Name.java:868)
      	at bsh.BSHMethodInvocation.eval(BSHMethodInvocation.java:69)
      	at bsh.BSHPrimaryExpression.eval(BSHPrimaryExpression.java:96)
      	at bsh.BSHPrimaryExpression.eval(BSHPrimaryExpression.java:41)
      	at bsh.BSHBlock.evalBlock(BSHBlock.java:125)
      	at bsh.BSHBlock.eval(BSHBlock.java:75)
      	at bsh.BshMethod.invokeImpl(BshMethod.java:356)
      	at bsh.BshMethod.invoke(BshMethod.java:252)
      	at bsh.BshMethod.invoke(BshMethod.java:180)
      	at bsh.This.invokeMethod(This.java:248)
      	at MyComposer.doAfterCompose(BeanShell Generated via ASM (www.objectweb.org))
      	at org.zkoss.zk.ui.impl.UiEngineImpl.doAfterCompose(UiEngineImpl.java:617)
      	at org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild0(UiEngineImpl.java:948)
      	at org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild(UiEngineImpl.java:895)
      	at org.zkoss.zk.ui.impl.UiEngineImpl.execCreate0(UiEngineImpl.java:777)
      	at org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild(UiEngineImpl.java:842)
      	at org.zkoss.zk.ui.impl.UiEngineImpl.execCreate0(UiEngineImpl.java:797)
      	at org.zkoss.zk.ui.impl.UiEngineImpl.execCreate(UiEngineImpl.java:740)
      	at org.zkoss.zk.ui.impl.UiEngineImpl.execNewPage0(UiEngineImpl.java:461)
      	at org.zkoss.zk.ui.impl.UiEngineImpl.execNewPage(UiEngineImpl.java:369)
      	at org.zkoss.zk.ui.http.DHtmlLayoutServlet.process(DHtmlLayoutServlet.java:211)
      	at org.zkoss.zk.ui.http.DHtmlLayoutServlet.doGet(DHtmlLayoutServlet.java:137)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
      ...
      

      Expected Result

      1. no exception thrown
      2. view model initialization when parent is added to page

      Debug Info

      creating components on a non-attached component causes the issue in initViewModel.

      Workaround

      attaching the newDiv before calling createComponents avoids the problem

      	public void doAfterCompose(Component comp) {
      		Div newDiv = new Div();
      		comp.appendChild(newDiv); //append the newDiv before creating children using MVVM viewModels
      		Executions.createComponents("mvvminc.zul", newDiv, null);
      	}
      
      1. mvvminc.zul
        0.2 kB
        cor3000
      2. vminit-aftercompose.zul
        0.4 kB
        cor3000

        Issue Links

          Activity

          cor3000 cor3000 created issue -
          cor3000 cor3000 made changes -
          Field Original Value New Value
          Attachment vminit-aftercompose.zul [ 20919 ]
          Attachment mvvminc.zul [ 20920 ]
          cor3000 cor3000 made changes -
          Description h2. Steps to Reproduce
          run the attached example

          h2. Current Result
          Exception:

          {noformat}
          org.zkoss.zk.ui.UiException: can't find Page to resolve a view model class :'MyVm' at [file:/D:/workspace/projects_idea/support/zksupport8/src/main/webapp/potential/5193-vminit-aftercompose/mvvminc.zul, line:7, nearby column: 43]
          at org.zkoss.bind.BindComposer.initViewModel(BindComposer.java:254)
          at org.zkoss.bind.BindComposer.doBeforeComposeChildren(BindComposer.java:150)
          at org.zkoss.zk.ui.impl.UiEngineImpl.doBeforeComposeChildren(UiEngineImpl.java:997)
          at org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild0(UiEngineImpl.java:937)
          at org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild(UiEngineImpl.java:895)
          at org.zkoss.zk.ui.impl.UiEngineImpl.execCreate0(UiEngineImpl.java:777)
          at org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild(UiEngineImpl.java:842)
          at org.zkoss.zk.ui.impl.UiEngineImpl.execCreate0(UiEngineImpl.java:797)
          at org.zkoss.zk.ui.impl.UiEngineImpl.execCreate(UiEngineImpl.java:740)
          at org.zkoss.zk.ui.impl.UiEngineImpl.createComponents(UiEngineImpl.java:1150)
          at org.zkoss.zk.ui.impl.AbstractExecution.createComponents0(AbstractExecution.java:346)
          at org.zkoss.zk.ui.impl.AbstractExecution.createComponents(AbstractExecution.java:307)
          at org.zkoss.zk.ui.Executions.createComponents(Executions.java:176)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:498)
          at bsh.Reflect.invokeMethod(Reflect.java:131)
          at bsh.Reflect.invokeStaticMethod(Reflect.java:95)
          at bsh.Name.invokeMethod(Name.java:868)
          at bsh.BSHMethodInvocation.eval(BSHMethodInvocation.java:69)
          at bsh.BSHPrimaryExpression.eval(BSHPrimaryExpression.java:96)
          at bsh.BSHPrimaryExpression.eval(BSHPrimaryExpression.java:41)
          at bsh.BSHBlock.evalBlock(BSHBlock.java:125)
          at bsh.BSHBlock.eval(BSHBlock.java:75)
          at bsh.BshMethod.invokeImpl(BshMethod.java:356)
          at bsh.BshMethod.invoke(BshMethod.java:252)
          at bsh.BshMethod.invoke(BshMethod.java:180)
          at bsh.This.invokeMethod(This.java:248)
          at MyComposer.doAfterCompose(BeanShell Generated via ASM (www.objectweb.org))
          at org.zkoss.zk.ui.impl.UiEngineImpl.doAfterCompose(UiEngineImpl.java:617)
          at org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild0(UiEngineImpl.java:948)
          at org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild(UiEngineImpl.java:895)
          at org.zkoss.zk.ui.impl.UiEngineImpl.execCreate0(UiEngineImpl.java:777)
          at org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild(UiEngineImpl.java:842)
          at org.zkoss.zk.ui.impl.UiEngineImpl.execCreate0(UiEngineImpl.java:797)
          at org.zkoss.zk.ui.impl.UiEngineImpl.execCreate(UiEngineImpl.java:740)
          at org.zkoss.zk.ui.impl.UiEngineImpl.execNewPage0(UiEngineImpl.java:461)
          at org.zkoss.zk.ui.impl.UiEngineImpl.execNewPage(UiEngineImpl.java:369)
          at org.zkoss.zk.ui.http.DHtmlLayoutServlet.process(DHtmlLayoutServlet.java:211)
          at org.zkoss.zk.ui.http.DHtmlLayoutServlet.doGet(DHtmlLayoutServlet.java:137)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
          ...
          {noformat}

          h2. Expected Result
          1. no exception thrown
          2. view model initialization when parent is added to page

          h2. Steps to Reproduce
          run the attached example
          [^vminit-aftercompose.zul]

          h2. Current Result
          Exception:

          {noformat}
          org.zkoss.zk.ui.UiException: can't find Page to resolve a view model class :'MyVm' at [file:/D:/workspace/projects_idea/support/zksupport8/src/main/webapp/potential/5193-vminit-aftercompose/mvvminc.zul, line:7, nearby column: 43]
          at org.zkoss.bind.BindComposer.initViewModel(BindComposer.java:254)
          at org.zkoss.bind.BindComposer.doBeforeComposeChildren(BindComposer.java:150)
          at org.zkoss.zk.ui.impl.UiEngineImpl.doBeforeComposeChildren(UiEngineImpl.java:997)
          at org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild0(UiEngineImpl.java:937)
          at org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild(UiEngineImpl.java:895)
          at org.zkoss.zk.ui.impl.UiEngineImpl.execCreate0(UiEngineImpl.java:777)
          at org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild(UiEngineImpl.java:842)
          at org.zkoss.zk.ui.impl.UiEngineImpl.execCreate0(UiEngineImpl.java:797)
          at org.zkoss.zk.ui.impl.UiEngineImpl.execCreate(UiEngineImpl.java:740)
          at org.zkoss.zk.ui.impl.UiEngineImpl.createComponents(UiEngineImpl.java:1150)
          at org.zkoss.zk.ui.impl.AbstractExecution.createComponents0(AbstractExecution.java:346)
          at org.zkoss.zk.ui.impl.AbstractExecution.createComponents(AbstractExecution.java:307)
          at org.zkoss.zk.ui.Executions.createComponents(Executions.java:176)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:498)
          at bsh.Reflect.invokeMethod(Reflect.java:131)
          at bsh.Reflect.invokeStaticMethod(Reflect.java:95)
          at bsh.Name.invokeMethod(Name.java:868)
          at bsh.BSHMethodInvocation.eval(BSHMethodInvocation.java:69)
          at bsh.BSHPrimaryExpression.eval(BSHPrimaryExpression.java:96)
          at bsh.BSHPrimaryExpression.eval(BSHPrimaryExpression.java:41)
          at bsh.BSHBlock.evalBlock(BSHBlock.java:125)
          at bsh.BSHBlock.eval(BSHBlock.java:75)
          at bsh.BshMethod.invokeImpl(BshMethod.java:356)
          at bsh.BshMethod.invoke(BshMethod.java:252)
          at bsh.BshMethod.invoke(BshMethod.java:180)
          at bsh.This.invokeMethod(This.java:248)
          at MyComposer.doAfterCompose(BeanShell Generated via ASM (www.objectweb.org))
          at org.zkoss.zk.ui.impl.UiEngineImpl.doAfterCompose(UiEngineImpl.java:617)
          at org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild0(UiEngineImpl.java:948)
          at org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild(UiEngineImpl.java:895)
          at org.zkoss.zk.ui.impl.UiEngineImpl.execCreate0(UiEngineImpl.java:777)
          at org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild(UiEngineImpl.java:842)
          at org.zkoss.zk.ui.impl.UiEngineImpl.execCreate0(UiEngineImpl.java:797)
          at org.zkoss.zk.ui.impl.UiEngineImpl.execCreate(UiEngineImpl.java:740)
          at org.zkoss.zk.ui.impl.UiEngineImpl.execNewPage0(UiEngineImpl.java:461)
          at org.zkoss.zk.ui.impl.UiEngineImpl.execNewPage(UiEngineImpl.java:369)
          at org.zkoss.zk.ui.http.DHtmlLayoutServlet.process(DHtmlLayoutServlet.java:211)
          at org.zkoss.zk.ui.http.DHtmlLayoutServlet.doGet(DHtmlLayoutServlet.java:137)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
          ...
          {noformat}

          h2. Expected Result
          1. no exception thrown
          2. view model initialization when parent is added to page

          cor3000 cor3000 made changes -
          Link This issue relates to ZK-3765 [ ZK-3765 ]
          cor3000 cor3000 made changes -
          gh.lexorank.field.name Ranked higher
          cor3000 cor3000 made changes -
          gh.lexorank.field.name Ranked lower
          cor3000 cor3000 made changes -
          gh.lexorank.field.name Ranked lower
          cor3000 cor3000 made changes -
          gh.lexorank.field.name Ranked higher
          cor3000 cor3000 made changes -
          Description h2. Steps to Reproduce
          run the attached example
          [^vminit-aftercompose.zul]

          h2. Current Result
          Exception:

          {noformat}
          org.zkoss.zk.ui.UiException: can't find Page to resolve a view model class :'MyVm' at [file:/D:/workspace/projects_idea/support/zksupport8/src/main/webapp/potential/5193-vminit-aftercompose/mvvminc.zul, line:7, nearby column: 43]
          at org.zkoss.bind.BindComposer.initViewModel(BindComposer.java:254)
          at org.zkoss.bind.BindComposer.doBeforeComposeChildren(BindComposer.java:150)
          at org.zkoss.zk.ui.impl.UiEngineImpl.doBeforeComposeChildren(UiEngineImpl.java:997)
          at org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild0(UiEngineImpl.java:937)
          at org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild(UiEngineImpl.java:895)
          at org.zkoss.zk.ui.impl.UiEngineImpl.execCreate0(UiEngineImpl.java:777)
          at org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild(UiEngineImpl.java:842)
          at org.zkoss.zk.ui.impl.UiEngineImpl.execCreate0(UiEngineImpl.java:797)
          at org.zkoss.zk.ui.impl.UiEngineImpl.execCreate(UiEngineImpl.java:740)
          at org.zkoss.zk.ui.impl.UiEngineImpl.createComponents(UiEngineImpl.java:1150)
          at org.zkoss.zk.ui.impl.AbstractExecution.createComponents0(AbstractExecution.java:346)
          at org.zkoss.zk.ui.impl.AbstractExecution.createComponents(AbstractExecution.java:307)
          at org.zkoss.zk.ui.Executions.createComponents(Executions.java:176)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:498)
          at bsh.Reflect.invokeMethod(Reflect.java:131)
          at bsh.Reflect.invokeStaticMethod(Reflect.java:95)
          at bsh.Name.invokeMethod(Name.java:868)
          at bsh.BSHMethodInvocation.eval(BSHMethodInvocation.java:69)
          at bsh.BSHPrimaryExpression.eval(BSHPrimaryExpression.java:96)
          at bsh.BSHPrimaryExpression.eval(BSHPrimaryExpression.java:41)
          at bsh.BSHBlock.evalBlock(BSHBlock.java:125)
          at bsh.BSHBlock.eval(BSHBlock.java:75)
          at bsh.BshMethod.invokeImpl(BshMethod.java:356)
          at bsh.BshMethod.invoke(BshMethod.java:252)
          at bsh.BshMethod.invoke(BshMethod.java:180)
          at bsh.This.invokeMethod(This.java:248)
          at MyComposer.doAfterCompose(BeanShell Generated via ASM (www.objectweb.org))
          at org.zkoss.zk.ui.impl.UiEngineImpl.doAfterCompose(UiEngineImpl.java:617)
          at org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild0(UiEngineImpl.java:948)
          at org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild(UiEngineImpl.java:895)
          at org.zkoss.zk.ui.impl.UiEngineImpl.execCreate0(UiEngineImpl.java:777)
          at org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild(UiEngineImpl.java:842)
          at org.zkoss.zk.ui.impl.UiEngineImpl.execCreate0(UiEngineImpl.java:797)
          at org.zkoss.zk.ui.impl.UiEngineImpl.execCreate(UiEngineImpl.java:740)
          at org.zkoss.zk.ui.impl.UiEngineImpl.execNewPage0(UiEngineImpl.java:461)
          at org.zkoss.zk.ui.impl.UiEngineImpl.execNewPage(UiEngineImpl.java:369)
          at org.zkoss.zk.ui.http.DHtmlLayoutServlet.process(DHtmlLayoutServlet.java:211)
          at org.zkoss.zk.ui.http.DHtmlLayoutServlet.doGet(DHtmlLayoutServlet.java:137)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
          ...
          {noformat}

          h2. Expected Result
          1. no exception thrown
          2. view model initialization when parent is added to page

          h2. Steps to Reproduce
          run the attached example
          [^vminit-aftercompose.zul]

          h2. Current Result
          Exception:

          {noformat}
          org.zkoss.zk.ui.UiException: can't find Page to resolve a view model class :'MyVm' at [file:/D:/workspace/projects_idea/support/zksupport8/src/main/webapp/potential/5193-vminit-aftercompose/mvvminc.zul, line:7, nearby column: 43]
          at org.zkoss.bind.BindComposer.initViewModel(BindComposer.java:254)
          at org.zkoss.bind.BindComposer.doBeforeComposeChildren(BindComposer.java:150)
          at org.zkoss.zk.ui.impl.UiEngineImpl.doBeforeComposeChildren(UiEngineImpl.java:997)
          at org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild0(UiEngineImpl.java:937)
          at org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild(UiEngineImpl.java:895)
          at org.zkoss.zk.ui.impl.UiEngineImpl.execCreate0(UiEngineImpl.java:777)
          at org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild(UiEngineImpl.java:842)
          at org.zkoss.zk.ui.impl.UiEngineImpl.execCreate0(UiEngineImpl.java:797)
          at org.zkoss.zk.ui.impl.UiEngineImpl.execCreate(UiEngineImpl.java:740)
          at org.zkoss.zk.ui.impl.UiEngineImpl.createComponents(UiEngineImpl.java:1150)
          at org.zkoss.zk.ui.impl.AbstractExecution.createComponents0(AbstractExecution.java:346)
          at org.zkoss.zk.ui.impl.AbstractExecution.createComponents(AbstractExecution.java:307)
          at org.zkoss.zk.ui.Executions.createComponents(Executions.java:176)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:498)
          at bsh.Reflect.invokeMethod(Reflect.java:131)
          at bsh.Reflect.invokeStaticMethod(Reflect.java:95)
          at bsh.Name.invokeMethod(Name.java:868)
          at bsh.BSHMethodInvocation.eval(BSHMethodInvocation.java:69)
          at bsh.BSHPrimaryExpression.eval(BSHPrimaryExpression.java:96)
          at bsh.BSHPrimaryExpression.eval(BSHPrimaryExpression.java:41)
          at bsh.BSHBlock.evalBlock(BSHBlock.java:125)
          at bsh.BSHBlock.eval(BSHBlock.java:75)
          at bsh.BshMethod.invokeImpl(BshMethod.java:356)
          at bsh.BshMethod.invoke(BshMethod.java:252)
          at bsh.BshMethod.invoke(BshMethod.java:180)
          at bsh.This.invokeMethod(This.java:248)
          at MyComposer.doAfterCompose(BeanShell Generated via ASM (www.objectweb.org))
          at org.zkoss.zk.ui.impl.UiEngineImpl.doAfterCompose(UiEngineImpl.java:617)
          at org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild0(UiEngineImpl.java:948)
          at org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild(UiEngineImpl.java:895)
          at org.zkoss.zk.ui.impl.UiEngineImpl.execCreate0(UiEngineImpl.java:777)
          at org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild(UiEngineImpl.java:842)
          at org.zkoss.zk.ui.impl.UiEngineImpl.execCreate0(UiEngineImpl.java:797)
          at org.zkoss.zk.ui.impl.UiEngineImpl.execCreate(UiEngineImpl.java:740)
          at org.zkoss.zk.ui.impl.UiEngineImpl.execNewPage0(UiEngineImpl.java:461)
          at org.zkoss.zk.ui.impl.UiEngineImpl.execNewPage(UiEngineImpl.java:369)
          at org.zkoss.zk.ui.http.DHtmlLayoutServlet.process(DHtmlLayoutServlet.java:211)
          at org.zkoss.zk.ui.http.DHtmlLayoutServlet.doGet(DHtmlLayoutServlet.java:137)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
          ...
          {noformat}

          h2. Expected Result
          1. no exception thrown
          2. view model initialization when parent is added to page

          h2. Debug Info
          creating components on a non-attached component causes the issue in initViewModel.

          h2. Workaround
          attaching the newDiv before calling createComponents avoids the problem


          cor3000 cor3000 made changes -
          Description h2. Steps to Reproduce
          run the attached example
          [^vminit-aftercompose.zul]

          h2. Current Result
          Exception:

          {noformat}
          org.zkoss.zk.ui.UiException: can't find Page to resolve a view model class :'MyVm' at [file:/D:/workspace/projects_idea/support/zksupport8/src/main/webapp/potential/5193-vminit-aftercompose/mvvminc.zul, line:7, nearby column: 43]
          at org.zkoss.bind.BindComposer.initViewModel(BindComposer.java:254)
          at org.zkoss.bind.BindComposer.doBeforeComposeChildren(BindComposer.java:150)
          at org.zkoss.zk.ui.impl.UiEngineImpl.doBeforeComposeChildren(UiEngineImpl.java:997)
          at org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild0(UiEngineImpl.java:937)
          at org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild(UiEngineImpl.java:895)
          at org.zkoss.zk.ui.impl.UiEngineImpl.execCreate0(UiEngineImpl.java:777)
          at org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild(UiEngineImpl.java:842)
          at org.zkoss.zk.ui.impl.UiEngineImpl.execCreate0(UiEngineImpl.java:797)
          at org.zkoss.zk.ui.impl.UiEngineImpl.execCreate(UiEngineImpl.java:740)
          at org.zkoss.zk.ui.impl.UiEngineImpl.createComponents(UiEngineImpl.java:1150)
          at org.zkoss.zk.ui.impl.AbstractExecution.createComponents0(AbstractExecution.java:346)
          at org.zkoss.zk.ui.impl.AbstractExecution.createComponents(AbstractExecution.java:307)
          at org.zkoss.zk.ui.Executions.createComponents(Executions.java:176)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:498)
          at bsh.Reflect.invokeMethod(Reflect.java:131)
          at bsh.Reflect.invokeStaticMethod(Reflect.java:95)
          at bsh.Name.invokeMethod(Name.java:868)
          at bsh.BSHMethodInvocation.eval(BSHMethodInvocation.java:69)
          at bsh.BSHPrimaryExpression.eval(BSHPrimaryExpression.java:96)
          at bsh.BSHPrimaryExpression.eval(BSHPrimaryExpression.java:41)
          at bsh.BSHBlock.evalBlock(BSHBlock.java:125)
          at bsh.BSHBlock.eval(BSHBlock.java:75)
          at bsh.BshMethod.invokeImpl(BshMethod.java:356)
          at bsh.BshMethod.invoke(BshMethod.java:252)
          at bsh.BshMethod.invoke(BshMethod.java:180)
          at bsh.This.invokeMethod(This.java:248)
          at MyComposer.doAfterCompose(BeanShell Generated via ASM (www.objectweb.org))
          at org.zkoss.zk.ui.impl.UiEngineImpl.doAfterCompose(UiEngineImpl.java:617)
          at org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild0(UiEngineImpl.java:948)
          at org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild(UiEngineImpl.java:895)
          at org.zkoss.zk.ui.impl.UiEngineImpl.execCreate0(UiEngineImpl.java:777)
          at org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild(UiEngineImpl.java:842)
          at org.zkoss.zk.ui.impl.UiEngineImpl.execCreate0(UiEngineImpl.java:797)
          at org.zkoss.zk.ui.impl.UiEngineImpl.execCreate(UiEngineImpl.java:740)
          at org.zkoss.zk.ui.impl.UiEngineImpl.execNewPage0(UiEngineImpl.java:461)
          at org.zkoss.zk.ui.impl.UiEngineImpl.execNewPage(UiEngineImpl.java:369)
          at org.zkoss.zk.ui.http.DHtmlLayoutServlet.process(DHtmlLayoutServlet.java:211)
          at org.zkoss.zk.ui.http.DHtmlLayoutServlet.doGet(DHtmlLayoutServlet.java:137)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
          ...
          {noformat}

          h2. Expected Result
          1. no exception thrown
          2. view model initialization when parent is added to page

          h2. Debug Info
          creating components on a non-attached component causes the issue in initViewModel.

          h2. Workaround
          attaching the newDiv before calling createComponents avoids the problem


          h2. Steps to Reproduce
          run the attached example
          [^vminit-aftercompose.zul]

          h2. Current Result
          Exception:

          {noformat}
          org.zkoss.zk.ui.UiException: can't find Page to resolve a view model class :'MyVm' at [file:/D:/workspace/projects_idea/support/zksupport8/src/main/webapp/potential/5193-vminit-aftercompose/mvvminc.zul, line:7, nearby column: 43]
          at org.zkoss.bind.BindComposer.initViewModel(BindComposer.java:254)
          at org.zkoss.bind.BindComposer.doBeforeComposeChildren(BindComposer.java:150)
          at org.zkoss.zk.ui.impl.UiEngineImpl.doBeforeComposeChildren(UiEngineImpl.java:997)
          at org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild0(UiEngineImpl.java:937)
          at org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild(UiEngineImpl.java:895)
          at org.zkoss.zk.ui.impl.UiEngineImpl.execCreate0(UiEngineImpl.java:777)
          at org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild(UiEngineImpl.java:842)
          at org.zkoss.zk.ui.impl.UiEngineImpl.execCreate0(UiEngineImpl.java:797)
          at org.zkoss.zk.ui.impl.UiEngineImpl.execCreate(UiEngineImpl.java:740)
          at org.zkoss.zk.ui.impl.UiEngineImpl.createComponents(UiEngineImpl.java:1150)
          at org.zkoss.zk.ui.impl.AbstractExecution.createComponents0(AbstractExecution.java:346)
          at org.zkoss.zk.ui.impl.AbstractExecution.createComponents(AbstractExecution.java:307)
          at org.zkoss.zk.ui.Executions.createComponents(Executions.java:176)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:498)
          at bsh.Reflect.invokeMethod(Reflect.java:131)
          at bsh.Reflect.invokeStaticMethod(Reflect.java:95)
          at bsh.Name.invokeMethod(Name.java:868)
          at bsh.BSHMethodInvocation.eval(BSHMethodInvocation.java:69)
          at bsh.BSHPrimaryExpression.eval(BSHPrimaryExpression.java:96)
          at bsh.BSHPrimaryExpression.eval(BSHPrimaryExpression.java:41)
          at bsh.BSHBlock.evalBlock(BSHBlock.java:125)
          at bsh.BSHBlock.eval(BSHBlock.java:75)
          at bsh.BshMethod.invokeImpl(BshMethod.java:356)
          at bsh.BshMethod.invoke(BshMethod.java:252)
          at bsh.BshMethod.invoke(BshMethod.java:180)
          at bsh.This.invokeMethod(This.java:248)
          at MyComposer.doAfterCompose(BeanShell Generated via ASM (www.objectweb.org))
          at org.zkoss.zk.ui.impl.UiEngineImpl.doAfterCompose(UiEngineImpl.java:617)
          at org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild0(UiEngineImpl.java:948)
          at org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild(UiEngineImpl.java:895)
          at org.zkoss.zk.ui.impl.UiEngineImpl.execCreate0(UiEngineImpl.java:777)
          at org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild(UiEngineImpl.java:842)
          at org.zkoss.zk.ui.impl.UiEngineImpl.execCreate0(UiEngineImpl.java:797)
          at org.zkoss.zk.ui.impl.UiEngineImpl.execCreate(UiEngineImpl.java:740)
          at org.zkoss.zk.ui.impl.UiEngineImpl.execNewPage0(UiEngineImpl.java:461)
          at org.zkoss.zk.ui.impl.UiEngineImpl.execNewPage(UiEngineImpl.java:369)
          at org.zkoss.zk.ui.http.DHtmlLayoutServlet.process(DHtmlLayoutServlet.java:211)
          at org.zkoss.zk.ui.http.DHtmlLayoutServlet.doGet(DHtmlLayoutServlet.java:137)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
          ...
          {noformat}

          h2. Expected Result
          1. no exception thrown
          2. view model initialization when parent is added to page

          h2. Debug Info
          creating components on a non-attached component causes the issue in initViewModel.

          h2. Workaround
          attaching the newDiv before calling createComponents avoids the problem


          {code:java}
          public void doAfterCompose(Component comp) {
          Div newDiv = new Div();
          comp.appendChild(newDiv); //append the newDiv before creating children using MVVM viewModels
          Executions.createComponents("mvvminc.zul", newDiv, null);
          }
          {code}

          rudyhuang rudyhuang made changes -
          Assignee bobpeng [ bobpeng ]
          cor3000 cor3000 made changes -
          gh.lexorank.field.name Ranked higher
          bobpeng bobpeng made changes -
          Status Open [ 1 ] In Progress [ 3 ]
          Original Estimate 1 day [ 28800 ]
          Remaining Estimate 1 day [ 28800 ]
          Fix Version/s 8.5.1 [ 15001 ]
          bobpeng bobpeng made changes -
          Status In Progress [ 3 ] Open [ 1 ]
          rudyhuang rudyhuang made changes -
          Assignee bobpeng [ bobpeng ] klyvechen [ klyvechen ]
          klyvechen klyvechen made changes -
          Status Open [ 1 ] In Progress [ 3 ]
          gh.issue.storypoints 2
          klyvechen klyvechen made changes -
          Comment [ ㄏ ]
          rudyhuang rudyhuang made changes -
          Status In Progress [ 3 ] Reviewing [ 10101 ]
          Hide
          rudyhuang rudyhuang added a comment -

          Same issue

          Show
          rudyhuang rudyhuang added a comment - Same issue
          rudyhuang rudyhuang made changes -
          Link This issue duplicates ZK-1547 [ ZK-1547 ]
          rudyhuang rudyhuang made changes -
          Status Reviewing [ 10101 ] Closed [ 6 ]
          Fix Version/s 8.5.1 [ 15001 ]
          Resolution Unresolved [ 8 ]
          rudyhuang rudyhuang made changes -
          Status Closed [ 6 ] Reopened [ 4 ]
          Hide
          rudyhuang rudyhuang added a comment -

          Fixed since 2018/01/29

          Show
          rudyhuang rudyhuang added a comment - Fixed since 2018/01/29
          rudyhuang rudyhuang made changes -
          Status Reopened [ 4 ] Closed [ 6 ]
          Fix Version/s 8.5.1 [ 15001 ]
          Resolution Unresolved [ 8 ] Fixed [ 1 ]

            People

            • Assignee:
              klyvechen klyvechen
              Reporter:
              cor3000 cor3000
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 1 day
                1d
                Remaining:
                Remaining Estimate - 1 day
                1d
                Logged:
                Time Spent - Not Specified
                Not Specified