<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V2.0//EN" "http://forrest.apache.org/dtd/document-v20.dtd">
<document>
    <header>
        <title>Java Server Faces</title>
    </header>
    <body>
        <section>
            <title>Introduction</title>
            <p>
                <a href="http://java.sun.com/j2ee/javaserverfaces/">JavaServer Faces</a> is
                technology for building web application user interfaces.  It allows development of
                very rich component- and event-based pages.  NetUI Page Flow treats JSF pages as
                <em>first-class citizens</em>.  In addition to allowing the use of "straight" JSF
                features, it integrates in the following ways:
            </p>
            <ul>
                <li>When a JSF page is accessed directly or from a Page Flow action, an
                    associated "backing bean" class is looked up.  If it exists, an instance is
                    created and managed by the framework.  This bean can contain JSF component
                    references, event handlers, etc., and it can <em>raise Page Flow actions</em>,
                    with or without form beans attached.  Its lifetime is tied to the lifetime of
                    the JSF page.
                </li>
                <li>
                    Components in JSF pages can also raise Page Flow actions directly, with or 
                    without form beans attached, using the built-in <code>action</code> attribute.
                </li>
                <li>
                    Pages can databind to NetUI objects using JSF-style expressions like
                    <code>#{pageFlow.someProperty}</code> or
                    <code>#{pageInput.somePageInput.someProperty}</code>.
                </li>
                <li>
                    A page can databind to properties in its associated backing bean through a
                    "backing" context, e.g., <code>#{backing.someProperty}</code>.
                </li>
                <li>When returning to a JSF page through the
                    <a href="apidocs/javadoc/org/apache/beehive/netui/pageflow/annotations/Jpf.Forward.html#navigateTo%28%29">navigateTo</a>
                    feature, the page's component tree and its backing bean are restored.
                </li>
            </ul>
            <p>
                The <a class="jump" href="site:docs/samples/netui-jsf">NetUI / JSF Sample</a> demonstrates these features.
            </p>

        </section>

        <section>
            <title>Enabling Java Server Faces</title>
            <p>To enable Java Server Faces in a Beehive web application, complete the following steps:</p>
                <section>
                    <title>Integrate JSF Tags in Your Web App</title>
                    <p>
                    Integrate JSF into your webapp.  You can use either <a href="http://myfaces.apache.org"><code>MyFaces v1.0.9 or later</code></a>, or 
                    the <a href="http://java.sun.com/j2ee/javaserverfaces/download.html">JSF Reference Implementation v1.1_01</a>.
                    </p>
                </section>
                <section>
                    <title>Configure Your Web Application</title>
                    <p>Add the following snippet to your <code>WEB-INF/faces-config.xml</code> file:</p>
      <source>&lt;factory>
  &lt;application-factory>
    org.apache.beehive.netui.pageflow.faces.PageFlowApplicationFactory
  &lt;/application-factory>
&lt;/factory></source>
                    <p>This goes underneath the <code>&lt;application></code> element and before the <code>&lt;navigation-rule></code> element(s).</p>

                </section>
            </section>
    </body>
    <footer>
            <legal>
            Java, J2EE, and JCP are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States 
            and other countries.<br/>&copy; 2004, Apache Software Foundation
        </legal>
        </footer>
</document>
