Jsf 在复合组件中未调用方法

Jsf 在复合组件中未调用方法,jsf,el,composite-component,methodnotfound,Jsf,El,Composite Component,Methodnotfound,有个问题快把我逼疯了。我试图显示复合组件中的值。但它永远不会被打印出来 <cc:interface> <cc:attribute name="parts" type="java.util.List" required="true""/> <cc:attribute name="context" type="String" required="true""/> </cc:interface> <!-- IMPLEMENTATI

有个问题快把我逼疯了。我试图显示复合组件中的值。但它永远不会被打印出来

<cc:interface>
    <cc:attribute name="parts" type="java.util.List" required="true""/>
    <cc:attribute name="context" type="String" required="true""/>
</cc:interface>

<!-- IMPLEMENTATION -->
<cc:implementation>
...
            <c:forEach items="#{cc.attrs.parts}" var="part">
...
                    <td>#{part.roles(cc.attrs.context)}</td>
...
            </c:forEach>
...
</cc:implementation>
parts
context
都有值(我可以打印它们),调用
{part.roles}
确实会打印HashMap。我错过什么了吗

public class Part implements Serializable {

    private HashMap<String, String> roles;
....
    // This can be called OK
    public HashMap<String, String> getRoles() {
        return roles;
    }

    public String getRoles(String id) {
    //Never called
        if ((roles != null) && (id != null)) {
            return roles.get(id);
        }
        return null;
    }
}
因此,使用
{part.getRoles(“Hello”)}
至少可以正确调用该方法。 但是,
cc.attrs.context
仍然没有正确地作为参数呈现(该方法没有被调用),即使它能够很好地呈现
{cc.attrs.context}


编辑2

有趣的。这很有效

<c:set var="ci" value="#{cc.attrs.context}" scope="request"/>
<td>#{part.getRoles(ci)}</td>
我不确定为什么第二个依赖项是必要的(TomEE应该足够了),但如果没有它,程序会给我这个错误:

Could not get component metadata for xxx.xhtml. Did you forget to specify <composite:interface>?
无法获取xxx.xhtml的组件元数据。你忘了具体说明了吗?

最近有一个非常类似但更一般的问题。你能提供版本信息吗?谢谢,我编辑了我的问题
<c:set var="ci" value="#{cc.attrs.context}" scope="request"/>
<td>#{part.getRoles(ci)}</td>
    <dependency>
        <groupId>javax</groupId>
        <artifactId>javaee-web-api</artifactId>
        <version>6.0</version> <!-- TomEE only supports 6.0 -->
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.glassfish</groupId>
        <artifactId>javax.faces</artifactId>
        <version>2.2.13</version>
        <scope>runtime</scope>
    </dependency>
Could not get component metadata for xxx.xhtml. Did you forget to specify <composite:interface>?