-
FEATURED COMPONENTS
First time here? Check out the FAQ!
I use a zul page/controller combo. Using zau.send I trigger a method in the controller (which works fine), but the event is null.
How to retrieve the parameter ?
I followed http://docs.zkoss.org/wiki/Client_Side_Programming#Communicate_to_Server
<?xml version="1.0" encoding="UTF-8"?> <zk xmlns="http://www.zkoss.org/2005/zul"> <window id="info" apply="controller.indexController" > <html><![CDATA[ <script type="text/javascript"> function callJavaMethod(){ zAu.send(new zk.Event(zk.Widget.$(this), 'onUser', 'Parameter')); } </script> <a href="#" onClick="callJavaMethod();">Click me</a> ]]></html> </window> </zk>
... public void onUser$info(Event event){ System.out.println("onUser get in server"); System.out.println(event.getData()); // gets null } ...
Any ideas ?
Thanks
Sven
Hi~~
public void onUser$info(Event event){ ForwardEvent eventx = (ForwardEvent)event; System.out.println(eventx.getOrigin().getData()); or Event eventx = Events.getRealOrigin((ForwardEvent)event); System.out.println(eventx.getData()); }
matthewgo,
Thank you so much. After several hours of frustration, I came to your answer and it saved the day. In debug mode, the event triggered at the server andI saw the the event date was there but event.getData() always produced null.
ggw
Asked: 2011-07-08 09:25:01 +0800
Seen: 728 times
Last updated: Apr 16 '12