简体   繁体   中英

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.

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.

Yes , you can

For example you can configure your web.xml as follows and divide it.

<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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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