Jsf 复合组件的@facescomponent的调用方法

Jsf 复合组件的@facescomponent的调用方法,jsf,composite-component,backing-beans,Jsf,Composite Component,Backing Beans,我需要调用一个方法来支持复合组件的组件(@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/facele

我需要调用一个方法来支持复合组件的组件(@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>

不应该调用
myAction
方法吗?我做错了什么?

您对属性进行了调用,因为方法需要使用:
action=“#{cc.myAction()}”

我使用了上面提到的代码,但做了一点小小的修改,它在我的服务器日志中打印出了
in action
值。我在ApacheTomcat8.0.9上使用了JSF2.2。我看不出有错误。你有任何进一步的信息吗?那是很久以前的事了。我甚至不记得那个代码发生了什么事。不管怎样,谢谢你的回复。检查这个
@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;
}
}