JSF Multiple configuration files

Source: Internet
Author: User

The JSF application configuration is handled through an XML file, which defaults to Faces-config.xml, where the application-supported sites, beans, navigation, and so on are configured. In actual development, if the project is large, many modules of the bean will be configured to the Faces-config.xml file, causing the file too large content miscellaneous, preferably as a spring configuration file into multiple, a module corresponding to a configuration file, so it is easy to manage.

JSF is a support for multiple configuration files. By default, it looks for file Web-inf/faces-config.xml and can specify additional profiles by Javax.faces.CONFIG_FILESS context parameters (Note: additional configuration Files ).

Additional configuration file: Refers to files other than faces-config.xml files. Because the Faces-config.xml file is the default file for the system, it is loaded automatically, and is repeated if specified again in the context parameter. So the default Faces-config.xml file must not be added.

Specific examples are as follows: (note: Due to personal network restrictions picture upload, temporarily do not upload picture description)


If the system has user management and system Management two modules, the implementation of multiple configuration files.

1, the file structure is as follows

----WebContent

--------Web-inf

------------Faces-config.xml

------------User-faces-config.xml

------------Sys-faces-config.xml

User-faces-config.xml file only configures the Manage bean associated with the user management module

Sys-faces-config.xml file only configures the Manage bean associated with the System Management module

JSF differs from spring multiple profiles and does not require additional JSF file path configurations specified in the Faces-config.xml file

If the system has user management and system Management two modules, the implementation of multiple configuration files.

2,web.xml file

<context-param>  
    <param-name>javax.faces.CONFIG_FILES</param-name>  
    <param-value >  
        /web-inf/user-faces-config.xml,  
        /web-inf/sys-faces-config.xml  
    </param-value>  


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.