My page:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html"
xmlns:compo="http://java.sun.com/jsf/composite/test">
<h:head>
</h:head>
<h:body>
<h:form>
<compo:composite changeListener="#{testBean.invoke}"/>
</h:form>
</h:body>
</html>
My composite component:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:composite="http://java.sun.com/jsf/composite"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html">
<composite:interface>
<composite:attribute name="changeListener" required="true"
method-signature="java.lang.Object action(javax.faces.event.AjaxBehaviorEvent)"/>
</composite:interface>
<composite:implementation>
<h:commandButton value="Click">
<f:ajax event="click" listener="#{cc.attrs.changeListener}"/>
</h:commandButton>
</composite:implementation>
</html>
My java bean (prototype scope in spring):
public class Bean {
public void invoke(javax.faces.event.AjaxBehaviorEvent event) {
// some logic
}
}
When I trying to press button, I see
02-Jul-2014 01:24:22.242 WARNING [http-apr-8080-exec-43] com.sun.faces.lifecycle.InvokeApplicationPhase.execute 0
java.lang.ArrayIndexOutOfBoundsException: 0
at org.apache.el.parser.AstValue.convertArgs(AstValue.java:287)
at org.apache.el.parser.AstValue.invoke(AstValue.java:241)
in log. For some cases I've got: java.lang.NumberFormatException: For input string: testBean.invoke
So, it is JSF bug or I do something wrong? How I can pass method expression inside composite component?