webtier@glassfish.java.net

Passing ajax listener into a component

From: <webtier_at_javadesktop.org>
Date: Sun, 21 Mar 2010 18:34:38 PDT

I have a simple composite component. Within that component, I have a command button with an attached f:ajax tag. If I specify the listener directly in the component, then everything works, like this:

<f:ajax execute="updatingListboxForm:newItemName"
    listener="#{genreSystemCategoryManager.saveNewGenreListener}"
    render="updatingListboxForm:itemsBox updatingListboxForm:newItemName"/>


If I remove that, and change the listener for a component attribute, then it throws an exception that says "wrong number of arguments."

The code that does _not_ work looks like this.

<comp:attribute
    name="saveListener"
    required="true"
    method-signature="void m(javax.faces.event.AjaxBehaviorEvent)" />

...

<f:ajax execute="updatingListboxForm:newItemName"
    listener="#{cc.attrs.saveListener}"
    render="updatingListboxForm:newItemName updatingListboxForm:itemsBox"/>


Am I specifying the method-signature wrong or something? Any help would be appreciated.

Joel

Here's the full trace of the final exception in the log
     [java] Caused by: java.lang.IllegalArgumentException: wrong number of arguments
     [java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     [java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
     [java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     [java] at java.lang.reflect.Method.invoke(Method.java:597)
     [java] at com.google.appengine.tools.development.agent.runtime.Runtime.invoke(Runtime.java:100)
     [java] at com.sun.el.parser.AstValue.invoke(AstValue.java:187)
     [java] at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:297)
     [java] at com.sun.faces.facelets.el.ContextualCompositeMethodExpression.invoke(ContextualCompositeMethodExpression.java:164)
     [java] at com.sun.faces.facelets.tag.TagAttributeImpl$AttributeLookupMethodExpression.invoke(TagAttributeImpl.java:443)
     [java] at com.sun.faces.facelets.tag.jsf.core.AjaxBehaviorListenerImpl.processAjaxBehavior(AjaxHandler.java:436)
     [java] at javax.faces.event.AjaxBehaviorEvent.processListener(AjaxBehaviorEvent.java:113)
     [java] at javax.faces.component.behavior.BehaviorBase.broadcast(BehaviorBase.java:98)
     [java] at javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:763)
     [java] at javax.faces.component.UICommand.broadcast(UICommand.java:300)
     [java] at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:775)
     [java] at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1267)
     [java] at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:82)
[Message sent by forum member 'jweight']

http://forums.java.net/jive/thread.jspa?messageID=393037