0
votes

I've got two JSF2 composite components: <my:modal /> and <my:about />. <my:modal /> supports inner children to populate a modal dialog:

<cc:implementation>
    <div class="modal fade" id="#{cc.clientId}" >
        <div class="modal-header">
            <a class="close" data-dismiss="modal">&times;</a>
            <h3>#{cc.attrs.title}</h3>
        </div>
        <div class="modal-body">
            <div class="well">
                <fieldset>
                    <div class="control-group">
                        <cc:insertChildren />
                    </div>
                </fieldset>
            </div>                    
        </div>
        <div class="modal-footer">
            <cc:renderFacet name="footer" />
        </div>
    </div>
</cc:implementation>

So a developer could use it by doing the following:

The <my:about /> tag re-uses the modal component like this:

<cc:implementation>
   <div id="#{cc.clientId}">
       <my:modal id="#{cc.clientId}:modal">
           <h:outputText value="#{cc.resourceBundleMap.ABOUT}" />
       </my:modal>
   </div>
</cc:implementation>

The problem I'm having is that it is looking for the ABOUT key in the resource bundle of the my:modal component instead of the my:about component. I would expect it to look-up the ABOUT key in the resource bundle of the component implementation instead of the nested components.

Is there a workaround for this?

1

1 Answers

2
votes

You can use parent to address attributes of the parent component. I never tried it with resource bundles. But from theory you could ..

replace

<h:outputText value="#{cc.resourceBundleMap.ABOUT}" />

with:

<h:outputText value="#{cc.parent.resourceBundleMap.ABOUT}" />