6
votes

I create a composite component like this:

<cc:interface>        
    <cc:attribute name="value" 
                  required="true" />
    <cc:attribute name="rendered"
                  displayName="True to render"
                  default="true" />
</cc:interface>

When I invoke this component, I get an IllegalArgumentException. I can changed the rendered name to something else (like doIt) and then it works.

Is the rendered attribute reserved somehow? I want my composite component to look like "regular" JSF components.

This is with Mojarra.

1
In the future, you don't need to explicitly tag [mojarra] if the problem is not Mojarra specific. You would have exactly the same problem when you tried for example MyFaces. Just mentioning JSF impl/version in the question is sufficient.BalusC
I put Mojarra there because I thought it might be a Mojarra bug. But point taken.AlanObject

1 Answers

15
votes

Composite components extend UINamingContainer which in turn extend UIComponentBase which in turn already definies the id and rendered attributes. You don't need to specify them yourself. Just remove the <cc:attribute name="rendered">. If you specify the rendered attribute on the composite component tag, then it'll be interpreted and applied on the composite component itself.

If you intend to render specific children of the composite, then better invent a different attribute name. For example, renderSomeChild.