Cannot get basic stuff to work
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4853709
By: davetam
try changing this:
<button label="Register" onClick="loginController.onRegister()" />
to
<button label="Register" forward="onRegister" />
Dave
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4853743
By: migu82
Ok, I got the register to work, but login does not seem to work still, even though I changed that to use the forward attribute too. And Im just curious that why is onClick attribute working and why was it on the tutorials if it is not meant to be used like that? Is it deprecated or something?
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4853858
By: snaef
You need to use the class name for your calls not the id of the window.
change loginController.onLogin() to Controller.onLogin()
The id attribute is only used to find and reference the window.
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4853865
By: snaef
err, scratch that I was wrong.
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4854198
By: waterbottle
Hi, Miku
Your code is OK, except change use="my.Controller" to use="my.LoginController".
Maybe that is just file synchronization problem, you application used a old version of your.zul file.
Please double check that.
/Dennis
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4855232
By: migu82
I actually have the my.controller set to my.LoginController and I still does not work. (had this all along, I just took away my original package structure
:))
I got the "forward" attributes to work, but I am still suprised, that why does the the tutorial states using the onClick="loginController.onRegister()" and it does not work?
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4855435
By: waterbottle
Colud you simplify the code first?
Such as
<button label="Register" onClick='alert("register")' /> <button label="Login" onClick='alert("login")' /> To see if it works or not?
If pass, then do more advance test step.
I can run your code in my environment actually (no forward).
I still think this is file synchronization or typo problem.
/Dennis
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4860263
By: migu82
Hey,
I still have the same problem, and it seems it's not becouse file sync/typo, I think I might be missing some important library or something, since it wont parse my ZUL/ZHTML correctly. I just tired to make a menu, using the reference guide straight and when I make an "variable" in the code it does not work.
So I have no backend java class, just this xml:
<menubar id="menubar">
<menu label="File">
<menupopup onOpen="alert(self.id)">
<menuitem label="New" onClick="alert(self.label)"/>
<menuitem label="Open" onClick="alert(self.label)"/>
<menuitem label="Save" onClick="alert(self.label)"/>
<menuseparator/>
<menuitem label="Exit" onClick="alert(self.label)"/>
</menupopup>
</menu>
<menu label="Help">
<menupopup>
<menuitem label="Index" onClick="alert(self.label)"/>
<menu label="About">
<menupopup>
<menuitem label="About ZK" onClick="alert(self.label)"/>
<menuitem label="About Potix" onClick="alert(self.label)"/>
</menupopup>
</menu>
</menupopup>
</menu>
</menubar>
And here's the error:
SEVERE: >>org.zkoss.zk.ui.UiException: Sourced file: inline evaluation
of: ``alert(self.id);'' : Class or variable not found: self.id : at Line: 1
: in file: inline evaluation of: ``alert(self.id);'' : self .id
>>Sourced file: inline evaluation of: ``alert(self.id);'' : Class or
>>variable
not found: self.id : at Line: 1 : in file: inline evaluation of: ``alert(self.id);''
: self .id
>>
>> at bsh.UtilEvalError.toEvalError(Unknown Source)
>> at bsh.UtilEvalError.toEvalError(Unknown Source)
>> at bsh.BSHAmbiguousName.toObject(Unknown Source) ...
24.3.2008 11:06:14 org.zkoss.zk.ui.impl.UiEngineImpl handleError:838
SEVERE: >>org.zkoss.zk.ui.UiException: Sourced file: inline evaluation
of: ``alert(self.id);'' : Class or variable not found: self.id : at Line: 1
: in file: inline evaluation of: ``alert(self.id);'' : self .id
>>Sourced file: inline evaluation of: ``alert(self.id);'' : Class or
>>variable
not found: self.id : at Line: 1 : in file: inline evaluation of: ``alert(self.id);''
: self .id
>>
>> at bsh.UtilEvalError.toEvalError(Unknown Source)
>> at bsh.UtilEvalError.toEvalError(Unknown Source)
>> at bsh.BSHAmbiguousName.toObject(Unknown Source) ...
24.3.2008 11:06:18 org.zkoss.zk.ui.impl.UiEngineImpl handleError:838
SEVERE: >>org.zkoss.zk.ui.UiException: Sourced file: inline evaluation
of: ``alert(self.label);'' : Class or variable not found: self.label : at Line:
1 : in file: inline evaluation of: ``alert(self.label);'' : self .label
>>Sourced file: inline evaluation of: ``alert(self.label);'' : Class or
>>variable
not found: self.label : at Line: 1 : in file: inline evaluation of:
``alert(self.label);'' : self .label
>>
>> at bsh.UtilEvalError.toEvalError(Unknown Source)
>> at bsh.UtilEvalError.toEvalError(Unknown Source)
>> at bsh.BSHAmbiguousName.toObject(Unknown Source) ...
24.3.2008 11:06:21 org.zkoss.zk.ui.impl.UiEngineImpl handleError:838
SEVERE: >>org.zkoss.zk.ui.UiException: Sourced file: inline evaluation
of: ``alert(self.id);'' : Class or variable not found: self.id : at Line: 1
: in file: inline evaluation of: ``alert(self.id);'' : self .id
>>Sourced file: inline evaluation of: ``alert(self.id);'' : Class or
>>variable
not found: self.id : at Line: 1 : in file: inline evaluation of: ``alert(self.id);''
: self .id
>>
>> at bsh.UtilEvalError.toEvalError(Unknown Source)
>> at bsh.UtilEvalError.toEvalError(Unknown Source)
>> at bsh.BSHAmbiguousName.toObject(Unknown Source)
These are my libraries, they are all in the runtime scope (if you know maven...), meaning they are not used at compile time.
If you have any idea what could be the problem I would be very greateful.
C:\Users\Miku\.m2\repository\commons-el\commons-el\1.0\commons-el-1.0.jar
C:\Users\Miku\.m2\repository\commons-logging\commons-logging\1.1.1\commons-loggi
ng-1.1.1.jar
C:\Users\Miku\.m2\repository\junit\junit\4.4\junit-4.4.jar
C:\Users\Miku\.m2\repository\org\apache\geronimo\specs\geronimo-servlet_2.5_spe
c\1.2\geronimo-servlet_2.5_spec-1.2.jar
C:\Users\Miku\.m2\repository\org\beanshell\bsh\1.3.0\bsh-1.3.0.jar
C:\Users\Miku\.m2\repository\org\javaopenaccess\javaopenaccess_core\1.0-SNAPSHOT
\javaopenaccess_core-1.0-SNAPSHOT.jar
C:\Users\Miku\.m2\repository\org\springframework\spring\2.5.2\spring-2.5.2.jar
C:\Users\Miku\.m2\repository\org\springframework\spring-webmvc\2.5.2\spring-webm
vc-2.5.2.jar
C:\Users\Miku\.m2\repository\org\springframework\spring-beans\2.5.2\spring-beans
-2.5.2.jar
C:\Users\Miku\.m2\repository\org\springframework\spring-core\2.5.2\spring-core-2
.5.2.jar
C:\Users\Miku\.m2\repository\org\springframework\spring-context\2.5.2\spring-con
text-2.5.2.jar
C:\Users\Miku\.m2\repository\aopalliance\aopalliance\1.0\aopalliance-1.0.jar
C:\Users\Miku\.m2\repository\org\springframework\spring-context-support\2.5.2\sp
ring-context-support-2.5.2.jar
C:\Users\Miku\.m2\repository\org\springframework\spring-web\2.5.2\spring-web-2.5
.2.jar
C:\Users\Miku\.m2\repository\org\zkoss\common\zweb\3.0.3\zweb-3.0.3.jar
C:\Users\Miku\.m2\repository\org\zkoss\common\zcommon\3.0.3\zcommon-3.0.3.jar
C:\Users\Miku\.m2\repository\commons-fileupload\commons-fileupload\1.1.1\commons
-fileupload-1.1.1.jar
C:\Users\Miku\.m2\repository\commons-io\commons-io\1.1\commons-io-1.1.jar
C:\Users\Miku\.m2\repository\org\zkoss\zkforge\el\zcommons-el\1.0.1\zcommons-el-
1.0.1.jar
C:\Users\Miku\.m2\repository\org\zkoss\zk\zhtml\3.0.3\zhtml-3.0.3.jar
C:\Users\Miku\.m2\repository\org\zkoss\zk\zk\3.0.3\zk-3.0.3.jar
C:\Users\Miku\.m2\repository\org\zkoss\zk\zkplus\3.0.3\zkplus-3.0.3.jar
C:\Users\Miku\.m2\repository\org\zkoss\zk\zul\3.0.3\zul-3.0.3.jar
C:\Users\Miku\.m2\repository\org\slf4j\slf4j-api\1.4.3\slf4j-api-1.4.3.jar
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4861754
By: waterbottle
Ok,
I think the beanshell version is too old.
Could you try the new version such as 2.0b4 ?
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4865277
By: migu82
Thanks, that was it! I knew I was on the right track with the dependecies, I just wasn't sure what was the actual wrong library, and somehow I disregarded the beanshell library...
ZK - Open Source Ajax Java Framework
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4853512
By: migu82
Hey,
Im totally new to ZK and I tried out a tutorial and I can get it to work.
I have a simple zul page:
<?xml version="1.0" encoding="UTF-8"?>
<?page title="Login to Java Open Access Web" ?> <window id="loginController" title="User Login" border="normal"
width="350px" use="my.Controller" >
<grid>
<rows>
<row>Username: <textbox id="username"/></row>
<row>Password: <textbox id="password" type="password"/></row>
<row>
<button label="Register" onClick="loginController.onRegister()"
/>
<button label="Login" onClick="loginController.onLogin()" />
</row>
</rows>
</grid>
</window>
and then I have the corresponding Java class:
public class LoginController extends Window {
/**
*
*/
private static final long serialVersionUID = -6575620885138147599L;
private Logger logger = Logger.getLogger(LoginController.class.getName());
public void onLogin(){
logger.info("on login");
}
public void onRegister(){
logger.info("on register");
}
public void onCreate(){
logger.info("on create");
}
}
the weird thing is the onCreate works, but when I press the button it shows an error, its like it doesn't see the loginController variable i have declared for the id for the window? What am I doing wrong? is there some other better way of calling the methods in Java?
Here's the error:
>>org.zkoss.zk.ui.UiException: Sourced file: inline evaluation of:
``loginController.onRegister();'' : Attempt to resolve method: onRegister() on undefined variable or class name: loginController : at Line: 1 : in file:
inline evaluation of: ``loginController.onRegister();'' : loginController .onRegister ( )
>>Sourced file: inline evaluation of: ``loginController.onRegister();''
>>: Attempt
to resolve method: onRegister() on undefined variable or class name: loginController
: at Line: 1 : in file: inline evaluation of: ``loginController.onRegister();''
: loginController .onRegister ( )
>>
>> at bsh.UtilEvalError.toEvalError(Unknown Source)
>> at bsh.UtilEvalError.toEvalError(Unknown Source)
>> at bsh.BSHMethodInvocation.eval(Unknown Source) ...