3

複合コンポーネントのバッキング コンポーネント(@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メソッドを呼び出すべきではありませんか? 私は何を間違えましたか?

4

1 に答える 1

0

メソッドを使用する必要があるため、プロパティの呼び出しを行います: action="#{cc.myAction()}"

于 2014-07-02T08:26:11.933 に答える