Introduction

MyFaces does have its own implementation of the JSF specification. But if you already have a working JSF web app based on the Sun JSF 1.1 reference implementation, you may want stay with it. The following describes the minimal steps necessary to add the MyFaces extensions to a Sun JSF 1.1 web app.

Steps

<!-- Extensions Filter -->
<filter>
        <filter-name>extensionsFilter</filter-name>
        <filter-class>
                org.apache.myfaces.component.html.util.ExtensionsFilter
        </filter-class>
        <init-param>
                <description>
                        Set the size limit for uploaded files. Format: 10 - 10
                        bytes 10k - 10 KB 10m - 10 MB 1g - 1 GB
                </description>
                <param-name>uploadMaxFileSize</param-name>
                <param-value>100m</param-value>
        </init-param>
        <init-param>
                <description>
                        Set the threshold size - files below this limit are
                        stored in memory, files above this limit are stored on
                        disk.
                        Format: 10 - 10 bytes 10k - 10 KB 10m - 10 MB 1g - 1 GB
                </description>
                <param-name>uploadThresholdSize</param-name>
                <param-value>100k</param-value>
        </init-param>
        <!--
        <init-param>
                <param-name>uploadRepositoryPath</param-name>
                <param-value>/temp</param-value>
                <description>Set the path where the intermediary files will be stored.
                </description>
        </init-param>
        -->
</filter>
<filter-mapping>
        <filter-name>extensionsFilter</filter-name>
        <url-pattern>*.faces</url-pattern>
</filter-mapping>
<filter-mapping>
        <filter-name>extensionsFilter</filter-name>
        <url-pattern>/faces/*</url-pattern>
</filter-mapping>

Note: you may need to change the url-pattern to match whatever pattern you are using (e.g. *.jsf instead of *.faces).

<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%> 

That's it! You should now be able to add MyFaces components to your .jsp page.

How_to_add_MyFaces_support_to_a_Sun_JSF_RI_application (last edited 2009-09-20 23:00:42 by localhost)