Java Reference
In-Depth Information
• To specify configuration elements for your application that are not available
through managed bean annotations, such as localized messages and navigation
rules
• To override managed bean annotations when the application is deployed
The application configuration resource file must be valid against the XML schema located
In addition, each file must include the following information, in the following order:
• The XML version number, usually with an
encoding
attribute:
<?xml version="1.0" encoding='UTF-8'?>
• A
faces-config
tag enclosing all the other declarations:
<faces-config version="2.0" xmlns="http://java.sun.com/xml/ns/
javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd">
...
</faces-config>
You can have more than one application configuration resource file for an application. The
JavaServer Faces implementation finds the configuration file or files by looking for the
following:
• A resource named
/META-INF/faces-config.xml
in any of the JAR files
in the web application's
/WEB-INF/lib/
directory and in parent class loaders.
If a resource with this name exists, it is loaded as a configuration resource. This
method is practical for a packaged library containing some components and ren-
derers. In addition, any file with a name that ends in
faces-config.xml
is
also considered a configuration resource and is loaded as such.
•
A context initialization parameter,
javax.faces.application.CONFIG_FILES
, in your web deployment
descriptor file that specifies one or more (comma-delimited) paths to multiple
configuration files for your web application. This method is most often used for
enterprise-scale applications that delegate to separate groups the responsibility for
maintaining the file for each portion of a big application.