Java 如何缩短资源包调用?复合组件?
我对内置JSF资源包的可能性不太满意,比如:Java 如何缩短资源包调用?复合组件?,java,jsf,resourcebundle,Java,Jsf,Resourcebundle,我对内置JSF资源包的可能性不太满意,比如: <h:outputFormat value="#{messages['form.label.create']}"> 因此,我尝试编写自己的复合组件,以缩短以下内容: <composite:interface> <composite:attribute name="value" /> <composite:attribute name="p1" /> </composite
<h:outputFormat value="#{messages['form.label.create']}">
因此,我尝试编写自己的复合组件,以缩短以下内容:
<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>
//text.properties
用法:
<cc:messages value="label.name" p1="#{test}" />
但是表达式messages['cc.attrs.value']
在资源包中查找cc.attrs.*而不是获取值内容
我能忘记我的方法吗?有人知道如何做类似的事情吗?试着写
消息[cc.attrs.value]
JSF将'cc.attrs.value'
解释为字符串值而不是变量名