Previous Section  < Day Day Up >  Next Section

13.3 Packaging Custom Classes

JSF merges the definitions found in multiple faces-config.xml files. When a JSF application starts, the implementation looks for faces-config.xml files in this order:

  1. All JAR file resources in the web application's ServletContext resource paths (in the reverse order of which they are returned by the ServletContext getResourcePaths( ) method) are scanned for files named META-INF/faces-config.xml.

  2. A comma-separated list of context-relative paths defined by the javax.faces.CONFIG_FILES context parameter in the web.xml file.

  3. The WEB-INF/faces-config.xml file.

This algorithm allows developers of custom classes to bundle them in JAR files with their declarations, making installation as easy as dropping the JAR file into the WEB-INF/lib directory. Because the WEB-INF/faces-config.xml file is considered last, you can override all configuration setting for a specific application in this file. Factory classes can be declared in additional files. See Appendix D for details.

    Previous Section  < Day Day Up >  Next Section