-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi,from this example Im Trying to Listen onClick event from XHTML component insidel zul file .but I always getting an error.
@command('fromHtml');'' Token Parsing Error: Lexical error at line 22, column 2. Encountered: "c" (99), after : "@": <at unknown location>
here my .zul
<zk xmlns:n="native" xmlns:x="xhtml" xmlns:zk="zk">
<div width="100%" apply="org.zkoss.bind.BindComposer"
viewModel="@id('vm') @init('com.self.PracticeVM')">
<x:input type="button" value="Test" zk:onClick="@command('addItem')" />
</div>
</zk>
and here my Java VM class :
public class PractiveVM{
@command
public void addItem(){
System.out.println("From XHTML components");
}
}
any suggestion ?
Regards,
Klepon
Hello Klepon,
There are two changes you have to make in your code:
Remove zk: from the command
Update the annotation of the @command to @Command
Please find below the full code:
Zul:
<zk xmlns:n="native" xmlns:x="xhtml" xmlns:zk="zk">
<div width="100%" apply="org.zkoss.bind.BindComposer"
viewModel="@id('vm') @init('com.self.PracticeVM')">
<x:input type="button" value="Test" onClick="@command('addItem')" />
</div>
</zk>
Java:
package com.self;
import org.zkoss.bind.annotation.Command;
public class PracticeVM {
@Command
public void addItem(){
System.out.println("From XHTML components");
}
}
Best Regards,
Darksu
Asked: 2015-06-26 04:31:42 +0800
Seen: 36 times
Last updated: Jun 26 '15
EL in a forEach @command not working?
Deselect listbox by clicking outside
Make conditional drop effect according to dragged widget ?
ZK Studio Support for Custom Components
composite component help [closed]
Different template for each grid row
Cardlayout animation is broken