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

The "import Classes" directive doesn't work for zscript

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Normal Normal
    • 6.5.1
    • 6.5.0
    • General
    • None

      The import Classes directive works for apply attribute.
      But it doesn't work for zscript.

      ZUL
      <?import foo.*?>
      <zk>
      	<window border="normal" width="200px" apply="MyComposer"> <!-- works here -->
      		<label id="msg" />
      		<zscript><![CDATA[
      			MyBean myBean = new MyBean(); // but throws exception here
      			msg.setValue(myBean.getHello());
      		]]></zscript>
      	</window>
      </zk>
      
      foo.MyBean
      package foo;
      
      public class MyBean {
      	public String getHello() {
      		return "hello";
      	}
      }
      
      foo.MyComposer
      package foo;
      
      import org.zkoss.zk.ui.select.SelectorComposer;
      import org.zkoss.zul.Window;
      
      public class MyComposer extends SelectorComposer<Window> {
      	private static final long serialVersionUID = 1L;
      
      	@Override
      	public void doAfterCompose(Window win) throws Exception {
      		super.doAfterCompose(win);
      		win.setTitle("hello");
      	}
      }
      

      By the way, this is no error:

      ZUL2
      <zk>
      	<zscript><![CDATA[
      			import foo.*;
      	]]></zscript>
      	<window border="normal" width="200px" apply="MyComposer">
      		<label id="msg" />
      		<zscript><![CDATA[
      			MyBean myBean = new MyBean(); 
      			msg.setValue(myBean.getHello());
      		]]></zscript>
      	</window>
      </zk>
      

            vincentjian vincentjian
            paowang paowang
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: