Chapter 19. Jakarta Server Faces configuration


The jsf subsystem enables the installation of multiple Jakarta Server Faces implementations on the same JBoss EAP server instance. You can install a version of Sun Mojarra or Apache MyFaces that implements the Jakarta Server Faces 4.0 specification or later. The feature pack can only be used to install the Apache MyFaces implementation.

Note

Only the Jakarta Server Faces implementation included with JBoss EAP is fully supported.

JBoss EAP supports provisioning a server with only the necessary features by using the JBoss EAP Installation Manager, which delivers these features as feature packs.

Prerequisites

  • You have installed JBoss EAP.

Procedure

  1. Create the myfaces-manifest.yaml file with the following content:

    schemaVersion: "1.0.0"
    name: "MyFaces manifest"
    id: "myfaces"
    streams:
      - groupId: "org.apache.myfaces.core"
        artifactId: "myfaces-api"
        version: "4.0.2"
      - groupId: "org.apache.myfaces.core"
        artifactId: "myfaces-impl"
        version: "4.0.2"
    Copy to Clipboard Toggle word wrap
  2. Add the MyFaces manifest by using the following command:

    $JBOSS_HOME/bin/jboss-eap-installation-manager.sh channel add \
      --channel-name=myfaces \
      --manifest=myfaces-manifest.yaml \
      --repositories=https://repo1.maven.org/maven2/
    Copy to Clipboard Toggle word wrap
  3. Deploy the MyFaces Maven manifest to your local Maven repository by using the following command:

    mvn deploy:deploy-file -Dfile=myfaces-manifest.yaml \
      -DgroupId=org.apache.myfaces.channel -DartifactId=myfaces \
      -Dclassifier=manifest -Dpackaging=yaml -Dversion=4.0.2 \
      -Durl=file://$HOME/.m2/repository
    Copy to Clipboard Toggle word wrap
  4. Provision a server using the MyFaces feature pack by using the following command:

    $JBOSS_HOME/bin/jboss-eap-installation-manager.sh fp add \
      --fpl=org.jboss.eap:eap-myfaces-feature-pack \
      --layers=myfaces
    Copy to Clipboard Toggle word wrap
  5. Start the server.

Verification

  • Use the following CLI command to verify that the new Jakarta Server Faces implementation has been installed successfully:

    [standalone@localhost:9990 /] /subsystem=jsf:list-active-jsf-impls()
    Copy to Clipboard Toggle word wrap

The multi-Jakarta Server Faces feature includes the default-jsf-impl-slot attribute in the jsf subsystem, which enables you to change the default Jakarta Server Faces implementation.

Prerequisites

  • You have the multiple Jakarta Server Faces implementations installed on the server.

Procedure

  1. Use the write-attribute command to set the value of the default-jsf-impl-slot attribute to one of the active Jakarta Server Faces implementations:

    /subsystem=jsf:write-attribute(name=default-jsf-impl-slot,value=JSF_IMPLEMENTATION)
    Copy to Clipboard Toggle word wrap

    Replace JSF_IMPLEMENTATION with the name of the Jakarta Server Faces implementation you want to set as default.

  2. Restart the JBoss EAP server for the change to take effect.

    reload
    Copy to Clipboard Toggle word wrap

Verification

  • Identify the available Jakarta Server Faces implementations by using the following command:

    /subsystem=jsf:read-attribute(name=default-jsf-impl-slot)
    Copy to Clipboard Toggle word wrap
    Expected output
    {
        "outcome" => "success",
        "result" => "myfaces"
    }
    Copy to Clipboard Toggle word wrap

To configure a Jakarta Server Faces application to use a Jakarta Server Faces implementation other than the default, add the org.jboss.jbossfaces.JSF_CONFIG_NAME context parameter to the web.xml file. This parameter instructs the jsf subsystem to apply the specified Jakarta Server Faces implementation when deploying the application.

For example, if you want to use MyFaces 4.0.0 in your application, include the following context parameter in the web.xml file:

<context-param>
    <param-name>org.jboss.jbossfaces.JSF_CONFIG_NAME</param-name>
    <param-value>myfaces-4.0.0</param-value>
</context-param>
Copy to Clipboard Toggle word wrap

If a Jakarta Server Faces application does not include this context parameter, the 'jsf' subsystem will use the default Jakarta Server Faces implementation.

19.4. Disallowing DOCTYPE declarations

You can configure the jsf subsystem to disallow DOCTYPE declarations in Jakarta Server Faces deployments. This setting improves security by preventing the use of external entities.

Prerequisites

  • You have management CLI access to configure the jsf subsystem.

Procedure

  1. Disallow DOCTYPE declarations in all Jakarta Server Faces deployments by using the following command:

    /subsystem=jsf:write-attribute(name=disallow-doctype-decl, value=true)
    Copy to Clipboard Toggle word wrap
  2. Restart the JBoss EAP server for the changes to take effect:

    reload
    Copy to Clipboard Toggle word wrap
  3. To allow DOCTYPE declarations for a specific Jakarta Server Faces deployment, add the com.sun.faces.disallowDoctypeDecl context parameter to the deployment’s web.xml file with the following configuration:

    <context-param>
        <param-name>com.sun.faces.disallowDoctypeDecl</param-name>
        <param-value>false</param-value>
    </context-param>
    Copy to Clipboard Toggle word wrap
Back to top
Red Hat logoGithubredditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust. Explore our recent updates.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

Theme

© 2025 Red Hat