Note that there are some explanatory texts on larger screens.

plurals
  1. POa4j:ajax listener exception MethodNotFoundException
    text
    copied!<p>I started study RichFaces 4.2.2 and have a problem in simple example, I have an xml:</p> <pre><code>&lt;ui:define name="content"&gt; &lt;h:form&gt; &lt;rich:panel style="width: 50%"&gt; &lt;h:panelGrid columns="2"&gt; &lt;h:outputText value="Name:"/&gt; &lt;h:inputText id="inp" value="#{echoBean.name}"&gt; &lt;a4j:ajax event="keyup" render="echo count" listener="#{echoBean.countListener}"/&gt; &lt;/h:inputText&gt; &lt;h:outputText value="Echo:"/&gt; &lt;h:outputText id="echo" value="#{echoBean.name}"/&gt; &lt;h:outputText value="Count:"/&gt; &lt;h:outputText id="count" value="#{echoBean.count}"/&gt; &lt;/h:panelGrid&gt; &lt;a4j:commandButton value="Submit" actionListener="#{echoBean.countListener}" render="echo, count"/&gt; &lt;/rich:panel&gt; &lt;/h:form&gt; &lt;/ui:define&gt; </code></pre> <p></p> <p>and a simple bean:</p> <pre><code>@Component("echoBean") @Scope(value = "session") public class EchoBean { private String name; private Integer count = 0; //getter setter methods here public void countListener(ActionEvent event) { count++; } } </code></pre> <p>And when i try to print in inputText i have exception:</p> <pre><code>Caused by: javax.el.MethodNotFoundException: /home.xhtml @35,112 listener="#{echoBean.countListener}": Method not found: com.example.training.bean.EchoBean@d523fa.countListener() at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:102) at org.ajax4jsf.component.behavior.MethodExpressionAjaxBehaviorListener.processAjaxBehavior(MethodExpressionAjaxBehaviorListener.java:71) at javax.faces.event.AjaxBehaviorEvent.processListener(AjaxBehaviorEvent.java:113) at javax.faces.component.behavior.BehaviorBase.broadcast(BehaviorBase.java:98) at org.ajax4jsf.component.behavior.AjaxBehavior.broadcast(AjaxBehavior.java:348) at javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:763) at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:775) at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1267) at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:82) ... 19 more </code></pre> <p>But why? With button this same listener works just fine and in docs for "listener" parameter in a4j:ajax it says that:</p> <p><em>The expression must evaluate to a public method that takes an ActionEvent parameter, with a return type of void, or to a public method that takes no arguments with a return type of void</em></p> <p>Why it uses <code>countListener()</code> without <code>ActionEvent</code> parameter? I don't get it.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload