Este contenido no está disponible en el idioma seleccionado.

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.

19.1. Installing a Jakarta Server Faces implementation

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"
  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/
  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
  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
  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()

19.2. Changing the default Jakarta Server Faces implementation

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)

    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

Verification

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

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

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>

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)
  2. Restart the JBoss EAP server for the changes to take effect:

    reload
  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>
Red Hat logoGithubredditYoutubeTwitter

Aprender

Pruebe, compre y venda

Comunidades

Acerca de la documentación de Red Hat

Ayudamos a los usuarios de Red Hat a innovar y alcanzar sus objetivos con nuestros productos y servicios con contenido en el que pueden confiar. Explore nuestras recientes actualizaciones.

Hacer que el código abierto sea más inclusivo

Red Hat se compromete a reemplazar el lenguaje problemático en nuestro código, documentación y propiedades web. Para más detalles, consulte el Blog de Red Hat.

Acerca de Red Hat

Ofrecemos soluciones reforzadas que facilitan a las empresas trabajar en plataformas y entornos, desde el centro de datos central hasta el perímetro de la red.

Theme

© 2026 Red Hat
Volver arriba