Configuring third-party JavaServer Faces 2.2 implementations

Use the JavaServer Faces (JSF) Container 2.2 feature to allow Contexts and Dependency Injection (CDI) integration to work with a JSF provider that is bundled within an application.

Before you begin

Use this feature only if you want a JSF provider different from the built-in Liberty JSF provider. If you want to use the default JSF provider from Liberty, use the jsf-2.2 feature instead.

About this task

Use the Liberty JSF container to package any 2.2.X version of the MyFaces or Mojarra JSF implementation within an application and also use Liberty CDI integrations. To configure a Liberty server to run an application with JSF 2.2, enable the jsfContainer-2.2 feature and package the JSF API and implementation inside of your application.

Important:
  • You cannot use the jsfContainer-2.2 feature with other JSF features, such as jsf-2.2.
  • To use the JSF container, package the JSF API javax.faces classes and a JSF implementation inside of the application. The program does not support packaging the JSF API and implementation in a shared library.
  • The jsfContainer-2.2 feature is supported only for the JSF API and implementation that correspond to the 2.2 version of the JSF specification. The MANIFEST.MF of the JSF API and implementation must define a Specification-Version between version ranges [2.2,2.3).
  • For JSF @ManagedBeans with jsfContainer-2.2, the program does not support the injection of objects with @Resource or @EJB beans. Use the CDI @Named beans instead.

Procedure

  1. Update the server.xml file to enable the jsfContainer-2.2 feature as it is displayed in the following example:
    <featureManager>
    	<feature>jsfContainer-2.2</feature>
    </featureManager>
  2. Package the JSF API and implementation for the JSF provider that you want to use within your application. For example, a .war (Web Archive) application that uses a JSF container with Mojarra might display as it does in the following example:
    /WEB-INF/lib/jsf-api-2.2.14.jar
    /WEB-INF/lib/jsf-impl-2.2.14.jar

    Alternatively, an application can package Apache MyFaces in the following locations within the app:

    /WEB-INF/lib/commons-beanutils-1.8.3.jar    # dependency of myfaces
    /WEB-INF/lib/commons-collections-3.2.1.jar  # dependency of myfaces
    /WEB-INF/lib/commons-digester-1.8.jar       # dependency of myfaces
    /WEB-INF/lib/commons-logging-1.1.3.jar      # dependency of myfaces
    /WEB-INF/lib/persistence-2.1.jar            # dependency of myfaces when using @EJB
    /WEB-INF/lib/myfaces-api-2.2.12.jar
    /WEB-INF/lib/myfaces-impl-2.2.12.jar

Results

The JSF Container 2.2 feature is enabled and loads in the Liberty server at run time. The feature uses the JSF API and implementation that are packaged within the application.