0

ZK + zkscript + Maven

asked 2009-11-13 13:57:00 +0800

DrFrank gravatar image DrFrank
39 1

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>

delete flag offensive retag edit

12 Replies

Sort by ยป oldest newest

answered 2009-11-13 13:57:51 +0800

DrFrank gravatar image DrFrank
39 1

Any suggestions????


Any help is appreciated..

link publish delete flag offensive edit

answered 2009-11-16 06:58:48 +0800

fmcypriano gravatar image fmcypriano
612 1 7
http://felipecypriano.com...

updated 2009-11-16 06:59:12 +0800

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.

link publish delete flag offensive edit

answered 2009-11-16 09:03:40 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16
http://www.oxitec.de/

updated 2009-11-16 09:06:52 +0800

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.

link publish delete flag offensive edit

answered 2009-11-17 10:42:30 +0800

DrFrank gravatar image DrFrank
39 1

mmm

With Cmposer the process i s not so responsive......

Do you think that I can use composer with same UI responsiveness??

link publish delete flag offensive edit

answered 2009-11-17 10:49:56 +0800

DrFrank gravatar image DrFrank
39 1

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......

link publish delete flag offensive edit

answered 2009-11-17 15:54:04 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16
http://www.oxitec.de/

zscript is interpreted (yes, on server)
Composer = java = compiled

link publish delete flag offensive edit

answered 2009-11-19 05:07:46 +0800

fmcypriano gravatar image fmcypriano
612 1 7
http://felipecypriano.com...

I really don't think zkscript are faster than composers and IMO the code inside zkscripts or scriptlets looks like a mess.

link publish delete flag offensive edit

answered 2009-11-19 08:44:43 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16
http://www.oxitec.de/

updated 2009-11-19 08:45:00 +0800

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 .

link publish delete flag offensive edit

answered 2009-11-20 10:23:11 +0800

DrFrank gravatar image DrFrank
39 1

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???

link publish delete flag offensive edit

answered 2009-11-20 10:24:17 +0800

DrFrank gravatar image DrFrank
39 1

I'm so sorry for my trivial questions but I'm very newbie in ZK and any suggestions are very appreciated...

Thank you for your help.......

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2009-11-13 13:57:00 +0800

Seen: 1,883 times

Last updated: Nov 21 '09

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More