-
FEATURED COMPONENTS
First time here? Check out the FAQ!
When i use zkoss 3 it works(with appropriate modifications, of course), but when I use zkoss 5 does not work, the error in the applet is started, in the following line:
JSO = JSObject.getWindow (this);
if someone can help me thanks in advance.
ZK File:
<zk xmlns="http://www.zkoss.org/2005/zul" xmlns:h="http://www.w3.org/1999/xhtml" xmlns:zk="http://www.zkoss.org/2005/zk" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <?script content="zk.useStackup = true;"?> <window id="test" width="100%" use="test.Test" apply="${testController}">
<script type="text/javascript"> function notifyServer() { var varUuid= $e("${wnd.uuid}").id; zkau.send({uuid: varUuid,cmd:"onNotifyServer",data:null,ctl:true}); } </script> <applet code="TestApplet" id="ticker" width="400px" style="border: 1px" mayscript="mayscript"> </applet>
Test.java
public class Test extends Window { static { addClientEvent(Test.class, "onNotifyServer", CE_IMPORTANT); //assume it is an important event } @Override public void service(org.zkoss.zk.au.AuRequest request, boolean everError) { String cmd = request.getCommand(); if (cmd.equals("onNotifyServer")) { Map data = request.getData(); int x = ((Integer)data.get("x")).intValue(); int y = ((Integer)data.get("y")).intValue(); //do whatever you want } else { super.service(request, everError); } } }
public void actionPerformed(ActionEvent e) { JSObject jso = null; try { jso = JSObject.getWindow(this); jso.call("notifyServer", new Object[] {"manuel hinojosa jara"}); System.out.println("notifyServer Fired!"); btnShowMessage.setText("START!"); } catch(JSException ex) { System.out.println("Could not create JS Object. Javascript Disabled!"); btnShowMessage.setText("ERROR!"); } }
Asked: 2011-03-10 14:00:25 +0800
Seen: 555 times
Last updated: May 24 '11