Java Reference
In-Depth Information
• A resource named
faces-config.xml
in the
/WEB-INF/
directory of your
application. Simple web applications make their configuration files available in
this way.
To access the resources registered with the application, an application developer can
use an instance of the
javax.faces.application.Application
class, which is
automatically created for each application. The
Application
instance acts as a central-
ized factory for resources that are defined in the XML file.
When an application starts up, the JavaServer Faces implementation creates a single in-
stance of the
Application
class and configures it with the information you provided
in the application configuration resource file.
Ordering of Application Configuration Resource Files
Because JavaServer Faces technology allows the use of multiple application configuration
resource files stored in different locations, the order in which they are loaded by the imple-
mentation becomes important in certain situations (for example, when using application-
level objects). This order can be defined through an
ordering
element and its subele-
ments in the application configuration resource file itself. The ordering of application con-
figuration resource files can be absolute or relative.
Absolute ordering is defined by an
absolute-ordering
element in the file. With ab-
solute ordering, the user specifies the order in which application configuration resource
files will be loaded. The following example shows an entry for absolute ordering:
File
my-faces-config.xml
:
<faces-config>
<name>myJSF</name>
<absolute-ordering>
<name>A</name>
<name>B</name>
<name>C</name>
</absolute-ordering>
</faces-config>
In this example, A, B, and C are different application configuration resource files and are
to be loaded in the listed order.
If there is an
absolute-ordering
element in the file, only the files listed by the
subelement
name
are processed. To process any other application configuration resource
files, an
others
subelement is required. In the absence of the
others
subelement, all
other unlisted files will be ignored at load time.