1
votes

I have a composite component that takes a specific object type as its value attribute. It looks like this:

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

The component merely produces a h:panelGrid with data elements from the object.

I have never had trouble with it until I tried using it inside a ui:repeat structure like this:

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

When this page is requested, it throws an exception:

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)

Other references to #{tally} inside the ui:repeat loop do not have any problem. They operate as expected. Is this a Mojarra bug or is there something in the JSF specification I didn't understand?

This is on Mojarra 2.1.0 (FCS 2.1.0-b11) in GlassFish 3.1.1

1
Never tried this with Mojarra 2.1.0, but it works fine for me locally on Mojarra 2.1.3 and it works fine as well in production environment using Mojarra 2.1.1 (m4n.nl, that top 10 list is generated by ui:repeat and the star score with popup is a composite). Are you sure that you didn't typo'ed the value attribute?BalusC
That's cut and paste (then a few deletes) from my application. The attribute is auto-completed in the Netbeans editor. however that is interesting there is a Mojarra 2.1.3 I thought I had the latest. Let me see if I can upgrade and try it again.AlanObject
@BalusC Well it turns out that I have 2.1.3 on my home system. My laptop is out of date. And it seems to be working now. Unfortunately I haven't preserved the failing code but I'll see if I can get it to fail again on my laptop.AlanObject
@BalusC Confirmed. 2.1.0 it fails 2.1.3 it works. If you want to repost as an answer I will mark it.AlanObject

1 Answers

2
votes

This is related to a bug which was fixed in Mojarra 2.1.1. Consider upgrading. I believe it's (in)directly the result of the visit hint fixes as mentioned in this overview of issues fixed in Mojarra 2.1.1.