Application Configuration Resource File - The Java EE 5 Tutorial (original) (raw)
2. Using the Tutorial Examples
3. Getting Started with Web Applications
5. JavaServer Pages Technology
7. JavaServer Pages Standard Tag Library
10. JavaServer Faces Technology
11. Using JavaServer Faces Technology in JSP Pages
12. Developing with JavaServer Faces Technology
13. Creating Custom UI Components
14. Configuring JavaServer Faces Applications
Using the managed-bean Element
Initializing Properties Using the managed-property Element
Referencing an Initialization Parameter
Initializing Array and List Properties
Initializing Managed Bean Properties
Registering Custom Error Messages
Registering Custom Localized Static Text
Registering a Custom Validator
Registering a Custom Converter
Registering a Custom Renderer with a Render Kit
Registering a Custom Component
Basic Requirements of a JavaServer Faces Application
Configuring an Application with a Deployment Descriptor
Identifying the Servlet for Life Cycle Processing
Specifying a Path to an Application Configuration Resource File
Specifying Where State Is Saved
Restricting Access to JavaServer Faces Components
Turning On Validation of XML Files
Including the Required JAR Files
Including the Classes, Pages, and Other Resources
15. Internationalizing and Localizing Web Applications
16. Building Web Services with JAX-WS
17. Binding between XML Schema and Java Classes
19. SOAP with Attachments API for Java
21. Getting Started with Enterprise Beans
23. A Message-Driven Bean Example
24. Introduction to the Java Persistence API
25. Persistence in the Web Tier
26. Persistence in the EJB Tier
27. The Java Persistence Query Language
28. Introduction to Security in the Java EE Platform
29. Securing Java EE Applications
31. The Java Message Service API
32. Java EE Examples Using the JMS API
36. The Coffee Break Application
37. The Duke's Bank Application
Application Configuration Resource File
JavaServer Faces technology provides a portable configuration format (as an XML document) for configuring resources. An application architect creates one or more files, called application configuration resource files, that use this format to register and configure objects and to define navigation rules. An application configuration resource file is usually called faces-config.xml.
The application configuration resource file must be valid against the schema located athttp://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd.
In addition, each file must include the following, in this order:
- The XML version number:
- A faces-config tag enclosing all the other declarations:
...
You can have more than one application configuration resource file. The JavaServer Faces implementation finds the 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 renderers.
- A context initialization parameter, javax.faces.application.CONFIG_FILES, that specifies one or more (comma-delimited) paths to multiple configuration files for your web application. This method will most likely be used for enterprise-scale applications that delegate to separate groups the responsibility for maintaining the file for each portion of a big application.
- A resource named faces-config.xml in the /WEB-INF/ directory of your application. This is the way most simple applications will make their configuration files available.
To access resources registered with the application, an application developer uses an instance of the Application class, which is automatically created for each application. The Application instance acts as a centralized factory for resources that are defined in the XML file.
When an application starts up, the JavaServer Faces implementation creates a single instance of the Application class and configures it with the information you configure in the application configuration resource file.
Copyright © 2010, Oracle and/or its affiliates. All rights reserved. Legal Notices