【发布时间】:2012-03-15 11:03:02
【问题描述】:
我对内置 JSF 资源包的可能性并不满意,例如:
<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>
用法:
<cc:messages value="label.name" p1="#{test}" />
但表达式 messages['cc.attrs.value'] 在资源包中查找 cc.attrs.* 而不是获取值内容。
我可以忘记我的方法吗?有没有人知道如何做类似的事情?
【问题讨论】:
标签: java jsf resourcebundle