复合组件参数在ui:repeat var属性时不会计算

问题描述 投票:1回答:1

我有一个复合组件,它将特定的对象类型作为其value属性。它看起来像这样:

<cc:interface>
    <cc:attribute name="value" 
                  type="com.myapp.Tally" 
                  required="true" 
</cc:interface>

该组件仅使用来自对象的数据元素生成h:panelGrid。

直到我尝试在ui中使用它之前我一直没有遇到过这样的问题:重复这样的结构:

<ui:repeat value="#{myApp.tallyList}" var="tally">    
  <p>
    <qc:tallySummaryH value="#{tally}" />
  </p>
</ui:repeat>

请求此页面时,它会抛出异常:

javax.faces.view.facelets.TagException: /table.xhtml @86,66 <qc:tallySummaryH> The following attribute(s) are required, but no values have been supplied for them: value. 
    at com.sun.faces.facelets.tag.composite.InterfaceHandler.validateComponent(InterfaceHandler.java:233)
    at com.sun.faces.facelets.tag.composite.InterfaceHandler.apply(InterfaceHandler.java:125)
    at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:98)
    at com.sun.faces.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:93)
    at com.sun.faces.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:86)
    at com.sun.faces.facelets.impl.DefaultFacelet.apply(DefaultFacelet.java:152)
    at com.sun.faces.facelets.tag.jsf.CompositeComponentTagHandler.applyCompositeComponent(CompositeComponentTagHandler.java:349)

在ui:repeat循环内对#{tally}的其他引用没有任何问题。它们按预期运行。这是一个Mojarra错误还是JSF规范中有些东西我不明白?

这是在GlassFish 3.1.1中的Mojarra 2.1.0(FCS 2.1.0-b11)

jsf-2 facelets composite-component mojarra
1个回答
2
投票

这与Mojarra 2.1.1中修复的错误有关。考虑一下upgrading。我相信它直接是访问提示修复的结果,如this overview中提到的Mojarra 2.1.1中修复的问题。

© www.soinside.com 2019 - 2024. All rights reserved.