Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/jsf/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jsf 连接两个不同的资源包_Jsf_Internationalization_Resourcebundle - Fatal编程技术网

Jsf 连接两个不同的资源包

Jsf 连接两个不同的资源包,jsf,internationalization,resourcebundle,Jsf,Internationalization,Resourcebundle,我们已经创建了一个基本jsf项目,其中包含了所有通用功能和实用程序,这些功能和实用程序将用作其余应用程序的框架。所以所有新的应用程序都会导入这个 我们面临着国际化的问题 父应用程序将有一个消息文件,其中包含所有项目可能共用的所有字符串 com.parent.i18n.messages mandatory-field=Field is mandatory numeric-field=Field must be numeric ... add-customer=Add customer delet

我们已经创建了一个基本jsf项目,其中包含了所有通用功能和实用程序,这些功能和实用程序将用作其余应用程序的框架。所以所有新的应用程序都会导入这个

我们面临着国际化的问题

父应用程序将有一个消息文件,其中包含所有项目可能共用的所有字符串 com.parent.i18n.messages

mandatory-field=Field is mandatory
numeric-field=Field must be numeric
...
add-customer=Add customer
delete-customer=Delete customer
...
将使用父项目的应用程序将拥有自己的i18文件,其中包含特定于该应用程序的消息

com.child.i18n.messages

mandatory-field=Field is mandatory
numeric-field=Field must be numeric
...
add-customer=Add customer
delete-customer=Delete customer
...
应用程序的faces-config.xml将包含这两个文件

<!-- Parent messages -->
<resource-bundle>
    <base-name>com.parent.i18n.messages</base-name>
    <var>msgbase</var>
</resource-bundle>
<!-- Application messages -->
<!-- Include base i18n for the wms-base pages -->
<resource-bundle>
    <base-name>com.child.i18n.messages-base</base-name>
    <var>msg</var>
</resource-bundle>

com.parent.i18n.messages
msgbase
com.child.i18n.messages-base
味精
从这个角度来看,我很容易将这些属性称为:

<h:outputText value="#{msg['add-customer']}" />
<h:outputText value="#{msgbase['mandatory-field']}" />

我们试图实现的是能够引用资源包,而不知道消息是在父项目上还是在项目本身中,例如:

<h:outputText value="#{allmsg['add-customer']}" />
<h:outputText value="#{allmsg['mandatory-field']}" />


有什么方法可以做到这一点吗?

可以帮助您吗?@david有没有解决方案的线索。plz与usDid的共享未能成功实现