Question

I'm using IntelliJ to develop Zk rendered pages and currently attempting to use MVVM to put data into a ListBox.

However I keep getting my template tags highlighted with the message from IntelliJ Element template not allowed here.

Is there anything I'm doing wrong from the below code?

<?page title="Main" contentType="text/html;charset=UTF-8"?>
<zk xmlns="http://www.zkoss.org/2005/zul"
             xmlns:h="http://www.w3.org/1999/xhtml"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://www.zkoss.org/2005/zul
                                   http://www.zkoss.org/2005/zul/zul.xsd">

 ...

           <center>
                <listbox model="@bind(cvm.contractsList)">
                    <listhead>
                        <listheader label="Contract #" hflex="1" />
                        <listheader label="Contract Name" hflex="1" />
                    </listhead>
                    <!-- below tags are red -->
                    <template name="model" var="contract">
                        <listitem>
                            <listcell label="@bind(contract.contractNumber)" />
                            <listcell label="@bind(contract.contractName)" />
                        </listitem>
                    </template>

My ZK dependencies from Maven are as follows:

...

<properties>
    <zk.version>6.5.2</zk.version>
</properties>

...

<dependencies>

  <dependency>
      <groupId>org.zkoss.zk</groupId>
      <artifactId>zkplus</artifactId>
      <version>${zk.version}</version>
  </dependency>

  <dependency>
      <groupId>org.zkoss.zk</groupId>
      <artifactId>zhtml</artifactId>
      <version>${zk.version}</version>
  </dependency>

  <dependency>
      <groupId>org.zkoss.zk</groupId>
      <artifactId>zkbind</artifactId>
      <version>${zk.version}</version>
  </dependency>

  <dependency>
      <groupId>org.zkoss.zk</groupId>
      <artifactId>zul</artifactId>
      <version>${zk.version}</version>
  </dependency>

  <dependency>
      <groupId>commons-logging</groupId>
      <artifactId>commons-logging</artifactId>
      <version>1.1.1</version>
  </dependency>

  <dependency>
      <groupId>commons-io</groupId>
      <artifactId>commons-io</artifactId>
      <version>1.3.1</version>
  </dependency>

  <dependency>
      <groupId>commons-lang</groupId>
      <artifactId>commons-lang</artifactId>
      <version>2.4</version>
  </dependency>

On what might be related - my VM is returning values, but my listBox is not currently displaying them (but I have not yet tested the code since changing config from @load to @bind).

Any help on the syntax issue would be appreciated.


Addendum - Another example:
It must be something in my schema configuration in IntelliJ. I always need to have the namespace at the top of my zul files but I notice that so many of the examples do not add this. I don't know why that is.

I have another example of invalidating a valid syntax. Today I had trouble with the validationMessages tag which is indicated as an error by IntelliJ. Sample code for that:

<window id="contractsReport" border="none" width="100%"     
      apply="org.zkoss.bind.BindComposer" viewModel="@id('vm') 
      @init('com.t2.anomalies.vm.AnomaliesReportsVm')" 
      validationMessages="@id('vmsgs')">
Was it helpful?

Solution

You're doing nothing wrong. It's just the zul.xsd schema is not very well maintained by the ZK folks. ...some other things are missing, too. So we'll just have to live with that. It actually is working at run time. So it's just some development time discomfort.

Anyway I used to put <zk> </zk> around <template> so the editor will accept it. But I stopped doing that for some reason I can't remember :-/ ...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top