0

zau.send parameter not accessible

asked 2011-07-08 09:25:01 +0800

javadude gravatar image javadude
63
http://javadude.wordpress...

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

delete flag offensive retag edit

2 Replies

Sort by ยป oldest newest

answered 2011-07-14 21:02:05 +0800

matthewgo gravatar image matthewgo
375

updated 2011-07-14 21:03:32 +0800

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());
}

link publish delete flag offensive edit

answered 2012-04-16 08:45:21 +0800

GGW gravatar image GGW
84

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

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: 2011-07-08 09:25:01 +0800

Seen: 727 times

Last updated: Apr 16 '12

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