简体   繁体   English

我们的JSF应用程序中可以有多个faces-config.xml文件吗?

[英]Can we have multiple faces-config.xml files in our JSF application?

I am working on a project which has grown bigger and lots of works still remains. 我正在做一个规模越来越大的项目,但仍有很多工作要做。 The thing is, the entries in my faces-config.xml has already spanned some 600 lines, and I fear it will double up in coming months. 关键是,我的faces-config.xml的条目已经跨越了大约600行,我担心它会在未来几个月内翻倍。

I was thinking if there might be some way so that I can have more than one faces-config.xml file in project, then I could have configured them according to my modules, which will ease to work with many folders. 我在考虑是否可以通过某种方法在项目中拥有多个faces-config.xml文件,然后可以根据我的模块进行配置,这将使它们可以轻松地用于许多文件夹。

Yes , you can 是的 ,你可以

For example you can configure your web.xml as follows and divide it. 例如,您可以按以下方式配置web.xml并将其分割。

<context-param>
    <param-name>javax.faces.CONFIG_FILES</param-name>
    <param-value>
        WEB-INF/module1/user-manage-beans.xml,
        WEB-INF/module1/user-navigation-rule.xml,
        WEB-INF/module2/patient-manage-beans.xml,
        WEB-INF/module2/patient-navigation-rule.xml
    </param-value>
</context-param>

The below code will work. 以下代码将起作用。

<context-param>
    <param-name>javax.faces.application.CONFIG_FILES</param-name>
    <param-value>
        /WEB-INF/faces-config.xml,
        /WEB-INF/configs/customer-config.xml
    </param-value>
  </context-param>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM