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

Append a zul page with viewmodel, you have to append the page to a component that available in the page

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Normal Normal
    • None
    • None
    • Databind 2
    • None

      testVM-add-zul.zul

      <zk>
      	<div id="cnt"></div>
      	<button label="append page">
      		<attribute name="onClick"><![CDATA[
      			Div div = new Div();
      			Executions.createComponents("testVM-include-1.zul", div, null);
      			
      			cnt.appendChild(div);
      		]]></attribute>
      	</button>
      	
      	
      </zk>
      

      testVM-include-1.zul

      <zk>
      	<zscript><![CDATA[
      		class MyVM2 {
      	
      		}
      	]]></zscript>
      	<window apply="org.zkoss.bind.BindComposer"
      		viewModel="@id('vm') @init('MyVM2')">
      	</window>
      </zk>
      
      SEVERE: >>org.zkoss.zk.ui.UiException: null
      >>java.lang.NullPointerException
      >>	at org.zkoss.bind.BindComposer.initViewModel(BindComposer.java:229)
      >>	at org.zkoss.bind.BindComposer.doBeforeComposeChildren(BindComposer.java:142)
      >>	at org.zkoss.zk.ui.impl.UiEngineImpl.doBeforeComposeChildren(UiEngineImpl.java:875)
      >>	at org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild0(UiEngineImpl.java:814)
      >>	at org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild(UiEngineImpl.java:771)
      >>	at org.zkoss.zk.ui.impl.UiEngineImpl.execCreate0(UiEngineImpl.java:680)
      >>	at org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild(UiEngineImpl.java:742)
      >>	at org.zkoss.zk.ui.impl.UiEngineImpl.execCreate0(UiEngineImpl.java:702)
      >>	at org.zkoss.zk.ui.impl.UiEngineImpl.execCreate(UiEngineImpl.java:644)
      >>	at org.zkoss.zk.ui.impl.UiEngineImpl.createComponents(UiEngineImpl.java:1025)
      >>	at org.zkoss.zk.ui.impl.AbstractExecution.createComponents0(AbstractExecution.java:246)
      >>	at org.zkoss.zk.ui.impl.AbstractExecution.createComponents(AbstractExecution.java:238)
      >>	at org.zkoss.zk.ui.Executions.createComponents(Executions.java:179)
      >>	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      >>	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      >>	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      >>	at java.lang.reflect.Method.invoke(Unknown Source)
      >>	at bsh.Reflect.invokeMethod(Unknown Source)
      >>	at bsh.Reflect.invokeStaticMethod(Unknown Source)
      >>	at bsh.Name.invokeMethod(Unknown Source)
      >>	at bsh.BSHMethodInvocation.eval(Unknown Source)
      >>	at bsh.BSHPrimaryExpression.eval(Unknown Source)
      >>	at bsh.BSHPrimaryExpression.eval(Unknown Source)
      >>	at bsh.Interpreter.eval(Unknown Source)
      >>	at bsh.Interpreter.eval(Unknown Source)
      >>	at org.zkoss.zk.scripting.bsh.BSHInterpreter.exec(BSHInterpreter.java:131)
      >>	at org.zkoss.zk.scripting.util.GenericInterpreter.interpret(GenericInterpreter.java:328)
      >>	at org.zkoss.zk.ui.impl.PageImpl.interpret(PageImpl.java:875)
      >>	at org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:2701)
      >>	at org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:2654)
      >>	at org.zkoss.zk.ui.impl.EventProcessor.process(EventProcessor.java:136)
      >>	at org.zkoss.zk.ui.impl.UiEngineImpl.processEvent(UiEngineImpl.java:1710)
      >>	at org.zkoss.zk.ui.impl.UiEngineImpl.process(UiEngineImpl.java:1495)
      >>	at org.zkoss.zk.ui.impl.UiEngineImpl.execUpdate(UiEngineImpl.java:1205)
      >>	at org.zkoss.zk.au.http.DHtmlUpdateServlet.process(DHtmlUpdateServlet.java:583)
      >>	at org.zkoss.zk.au.http.DHtmlUpdateServlet.doGet(DHtmlUpdateServlet.java:481)
      >>	at org.zkoss.zk.au.http.DHtmlUpdateServlet.doPost(DHtmlUpdateServlet.java:489)
      >>	at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
      >>	at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
      >>	at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
      >>	at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:401)
      >>	at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
      >>	at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
      >>	at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
      >>	at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:450)
      >>	at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
      >>	at org.mortbay.jetty.Server.handle(Server.java:326)
      >>	at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
      >>	at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:945)
      >>	at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756)
      >>	at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
      >>	at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
      >>	at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410)
      >>	at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
      

            Unassigned Unassigned
            jimmyshiau jimmyshiau
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: