【发布时间】:2014-03-12 15:29:19
【问题描述】:
我有一个在会话范围内提供“翻译方法”的简单 bean
String getText(String key, Object args ...) {
...// lookup in property resource
return value;
}
我正在尝试调用此 bean 以使我的 UI 组件本地化文本字符串。当尝试调用上述函数时,例如由
<p:outputLabel for="name" value="#{lang.getText(xyz,arg1)}" />
<p:inputText id="name" value="#{formProject.entity.name}"/>
<p:message for="name" id="msgName" />
我得到一个 java.lang.IllegalArgumentException: wrong number of arguments
现在,我的问题
1) Is this generally a good alternative to <f:loadBundle> to localize my components?
2) Since I am able to address my nested bean fields via bean1.bean2.myfield
how to avoid conflicts when adressing the properties dot-sepatated,
i.e. x.y.z instead of xyz?
我认为我目前没有走在正确的轨道上......
【问题讨论】: