-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi All.
I'm very newbie in ZK and I'm sorry for the trivial problem.....
I use ZK 3.6.2.
I'm using zk with maven and I have this problem with zkscrip:
This is an example:
<zscript>
void changeStyle(Label text) {
if ("focus".equals(text.sclass)) {
text.sclass = "";
} else {
text.sclass = "focus";
}
}
</zscript>
This script is carried from ZK Demo.
When I try it in ZK Project build from ZK Studio every thing works fine.
If a try to run it in a Project build with Maven, I have this Exception:
org.zkoss.zk.ui.UiException: Sourced file: inline evaluation of: `` text2.focus();;'' : Attempt to resolve method: focus() on undefined variable or class name: text2 : at Line: 33 : in file: inline evaluation of: `` text2.focus(); ;'' : text2 .focus ( )
>>Sourced file: inline evaluation of: `` text2.focus(); ;'' : Attempt to resolve method: focus() on undefined variable or class name: text2 : at Line: 33 : in file: inline evaluation of: `` text2.focus(); ;'' : text2 .focus ( )
>>
>> at bsh.UtilEvalError.toEvalError(Unknown Source)
>> at bsh.UtilEvalError.toEvalError(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:119)
>> at org.zkoss.zk.scripting.util.GenericInterpreter.interpret(GenericInterpreter.java:310)
>> at org.zkoss.zk.ui.impl.PageImpl.interpret(PageImpl.java:787)
>> at org.zkoss.zk.ui.impl.EventProcessor.process0(EventProcessor.java:176)
>> at org.zkoss.zk.ui.impl.EventProcessor.process(EventProcessor.java:141)
>>...
May be a scope problem, because the script doesn't found text1 filed......
I thing that I have forget some zk dependency in my pom.xml :
<dependency>
<groupId>org.zkoss.zk</groupId>
<artifactId>zml</artifactId>
<version>${zk.version}</version>
</dependency>
<dependency>
<groupId>org.zkoss.zk</groupId>
<artifactId>zkmax</artifactId>
<version>${zk.version}</version>
</dependency>
<dependency>
<groupId>org.zkoss.zk</groupId>
<artifactId>zk</artifactId>
<version>${zk.version}</version>
<type>jar</type>
<optional>false</optional>
</dependency>
<dependency>
<groupId>org.zkoss.zk</groupId>
<artifactId>zkex</artifactId>
<version>${zk.version}</version>
<type>jar</type>
<optional>false</optional>
</dependency>
<dependency>
<groupId>org.zkoss.zk</groupId>
<artifactId>zkplus</artifactId>
<version>${zk.version}</version>
<type>jar</type>
<optional>false</optional>
</dependency>
<dependency>
<groupId>org.zkoss.zk</groupId>
<artifactId>zul</artifactId>
<version>${zk.version}</version>
<type>jar</type>
<optional>false</optional>
</dependency>
<dependency>
<groupId>org.zkoss.zk</groupId>
<artifactId>zhtml</artifactId>
<version>${zk.version}</version>
<type>jar</type>
<optional>false</optional>
</dependency>
This kind of code works very well for me (I use Maven too), I'm using Composers to execute code that affects the components instead of zkscript. I really don't think that you should use zkscript in a actual project.
I miss the dependency for the BSH BeanShellInterpreter ! Something like:
<dependency> <groupId>org.beanshell</groupId> <artifactId>bsh</artifactId> <version>2.0b4</version> </dependency>
You must add it manually.
best
Stephan
PS: Help to prevent the global warming by writing cool software.
Perfect.... it works now!!!!!!
With this:
<dependency>
<groupId>org.beanshell</groupId>
<artifactId>bsh</artifactId>
<version>2.0b4</version>
</dependency>
I have this question now...... with the composer, I can get the same performace that <zscript>???? At moment I use Composer only for server-logic issue.......
Thank you......
zscript is interpreted (yes, on server)
Composer = java = compiled
I really don't think zkscript are faster than composers and IMO the code inside zkscripts or scriptlets looks like a mess.
I hope my last message is not missunderstood. Surely, java is faster, its compiled.
And i agree absolutly with Felipe. zscript is in my eyes for prototyping .
Ok.
Thank you......
It seems that using Composer is faster that scripting in ZK. It is good!!!
Onether question.... how about tag scope???
This is an example (using script but the same happen using Composer):
<row>
E-mail:
<textbox id="email" width="150px"
constraint="/.+@.+\.+/: Please enter an e-mail address" />
</row>
</rows>
</grid>
<groupbox>
<caption label="Event" />
<button id="update" label="Update"></button>
<button id="close" label="Close" onClick="editor.setVisible(true);listuser.setVisible(false)"></button>
</groupbox>
This above is short cut:
in the button "close" ther are some action to object editor and lisuser. But this object are defined in a page that include this one with tag <include>!!! How can I use the object editor and lisuser in included page and in his Composer???
Asked: 2009-11-13 13:57:00 +0800
Seen: 1,883 times
Last updated: Nov 21 '09