JSF

Hdiv installation steps for JavaServer Faces framework.

Before starting the installation check the environment setup.

Note

JavaServer Faces 2.0 is the minimum supported version.

Add Hdiv Dependencies

Add Hdiv dependencies to the web application project. To do this, add the following dependencies to the pom.xml file.

<dependency>
    <groupId>org.hdiv</groupId>
    <artifactId>hdiv-config</artifactId>
    <version>${org.hdiv-version}</version>
</dependency>
<dependency>
    <groupId>org.hdiv</groupId>
    <artifactId>hdiv-jsf</artifactId>
    <version>${org.hdiv-version}</version>
</dependency>

Modify web.xml

Add Hdiv listener, Hdiv Filter and define your custom faces-config (with Hdiv configuration, see the next point) within web.xml file.

<!-- Define the hdiv-faces-config -->
<context-param>
     <param-name>javax.faces.CONFIG_FILES</param-name>
     <param-value>/WEB-INF/hdiv-faces2-config.xml</param-value>
</context-param>

<!-- Hdiv Initialization listener -->
<listener>
    <listener-class>org.hdiv.listener.InitListener</listener-class>
</listener>

<!-- Hdiv Validator Filter -->
<filter>
    <filter-name>ValidatorFilter</filter-name>
    <filter-class>org.hdiv.filter.ValidatorFilter</filter-class>
</filter>
<filter-mapping>
    <filter-name>ValidatorFilter</filter-name>
    <servlet-name>Faces Servlet</servlet-name>
</filter-mapping>

Update hdiv-faces2-config.xml

This is the content of /WEB-INF/hdiv-faces2-config.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<faces-config xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
    version="2.0">

    <component>
        <component-type>javax.faces.HtmlOutcomeTargetLink</component-type>
        <component-class>org.hdiv.components.HtmlOutcomeTargetLinkExtension</component-class>
    </component>
    <component>
        <component-type>javax.faces.HtmlOutcomeTargetButton</component-type>
        <component-class>org.hdiv.components.HtmlOutcomeTargetButtonExtension</component-class>
    </component>
    <component>
        <component-type>javax.faces.Parameter</component-type>
        <component-class>org.hdiv.components.UIParameterExtension</component-class>
    </component>
    <component>
        <component-type>javax.faces.HtmlInputHidden</component-type>
        <component-class>org.hdiv.components.HtmlInputHiddenExtension</component-class>
    </component>
    <component>
        <component-type>javax.faces.HtmlOutputLink</component-type>
        <component-class>org.hdiv.components.HtmlOutputLinkExtension</component-class>
    </component>

    <lifecycle>
        <phase-listener>org.hdiv.phaseListeners.ComponentMessagesPhaseListener</phase-listener>
        <phase-listener>org.hdiv.phaseListeners.ConfigPhaseListener</phase-listener>
        <phase-listener>org.hdiv.phaseListeners.ValidatorPhaseListener</phase-listener>
    </lifecycle>

    <factory>
        <external-context-factory>org.hdiv.context.ExternalContextFactoryWrapper</external-context-factory>
    </factory>

</faces-config>