JavaServer Faces configuration scheme

The JavaServer Faces configuration scheme is the deployment descriptor for a JSF-enabled Web application. The JSF configuration file is used to register and configure objects and to define the navigation rules used in a Web application. The faces configuration file is typically named faces-config.xml file and is usually located in the WEB-INF folder of your Web project.

The configuration file must comply with the XML Schema for the JavaServer Faces Application Configuration File. The file must contain the XML version number, DOCTYPE declaration, and a <faces-config> tag to enclose all other declarations.

Example of a JSF configuration file.

The JSF configuration file is where you register JavaBeans™ that are used in your Web application, specify navigation rules, register custom components, register converters, and register validators.

The root element of the file is the <faces-config> tag. Each JavaBean you register will have a <managed-bean> tag, contained by the root element. The <managed-bean> element has three sub-elements:
  • <managed-bean-name> - This tag defines the name of the JavaBean.
  • <managed-bean-class> - This tag specifies the JavaBean class.
  • <managed-bean-scope> - This tag defines the scope of the JavaBean.
Navigation rules are defined in the <navigation-rule> element. This element contains the sub-elements.
  • <from-view-id> - This tag defines the rule.
  • <navigation-case> - This tag defines the conditions that must exist for this case to be executed.
  • <from-outcome> - This tag contains a logical outcome string returned by the execution of an application action method.
  • <to-view-id> - This tag contains the view identifier of the next view that should be displayed if this navigation rule is matched.

A Web application can have multiple application configuration resource files. If the files are not located in the default directory WEB-INF and/or are not named faces-config.xml, you need to specify paths to these files in the deployment descriptor.


Feedback