I’m not really happy with the built-in JSF resource bundle possibilities, like:
<h:outputFormat value="#{messages['form.label.create']}">
Therefore I tried to code my own composite component to shorten these things:
<composite:interface>
<composite:attribute name="value" />
<composite:attribute name="p1" />
</composite:interface>
<composite:implementation>
<h:outputFormat value="#{messages['cc.attrs.value']}"> //text.properties
<f:param value="#{cc.attrs.p1}" />
</h:outputFormat>
</composite:implementation>
Usage:
<cc:messages value="label.name" p1="#{test}" />
But the expression messages['cc.attrs.value'] looks up in resource bundle for cc.attrs.* instead of fetching the value content.
Can I forget about my approach? Has anyone an idea how to do similar things?
Try writing
messages[cc.attrs.value]instead.JSF is interpreting
'cc.attrs.value'as a string value not a variable name.