我需要调用一个支持复合组件的组件(@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
方法吗?我做错了什么?
答案 0 :(得分:0)
你要对属性进行调用,方法需要使用: 行动= “#{cc.myAction()}”