我需要调用复合组件的支持组件(@facescomponent)的方法。我在文章中看到其他人这样做,但没有一个对我有用。
这就是我调用的方式:
<ui:component xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:cc="http://java.sun.com/jsf/composite">
<cc:interface componentType="formField"/>
<cc:implementation>
<h:commandButton value="doIt" action="#{cc.myAction}" ></h:commandButton>
</cc:implementation>
</ui:component>
这是支持组件。
@FacesComponent("formField")
public class Field extends UICommand implements NamingContainer {
public Field() {
}
@Override
public String getFamily() {
return UINamingContainer.COMPONENT_FAMILY;
}
public String myAction() {
System.out.println("in action");//not printed
return null;
}
}
不myAction
应该调用方法吗?我做错了什么?