Page Flow: JSF Integration
Introduction
This sample shows how to integrate JSF (Java Server Faces) into your Page Flow web app. For more information see Java Server Faces.
Running the Sample on Tomcat 5
The following instructions explain how to run the sample on Tomcat 5. The sample will run on other web containers, but we have chosen Tomcat 5 for convenience.
To Set up the Environment
Before proceeding, complete all of the necessary and optional steps in the following topic: Beehive Installation and Setup
Open a command shell and confirm that you have set following variables:
- ANT_HOME
- JAVA_HOME
- CATALINA_HOME
Also ensure that the following elements are on your PATH:
- ANT_HOME/bin
- JAVA_HOME/bin
To Copy the Application to a Project Folder (Optional Step)
To keep your Beehive distribution directory pristine, you should copy the folder <BeehiveRoot>/samples/netui-jsf to another location before proceeding.
The following instructions assume that you have copied the folder netui-jsf into the directory C:/beehive_projects, resulting in the following directory structure.
C: beehive_projects netui-jsf
For example, to build the sample, run the following Ant command:
ant -f <BeehiveRoot>\samples\netui-jsf\src\WEB-INF\build.xml clean build war
To delete the sample's build directory, run the clean target:
ant -f <BeehiveRoot>\samples\netui-jsf\src\WEB-INF\build.xml clean
To Download a JSF Implementation
Download and install one of the following JSF implementations:
To Edit the build.properties File
In this section you will edit the build.properties file--the file that sets the build-related properties for your web application.
Open the file C:/beehive_projects/netui-jsf/WEB-INF/src/build.properties in a text editor.
Edit the file so that the beehive.home property points to the top-level folder of your beehive installation.
Also uncomment one of the properties myfaces.dir or jsf-ri.dir. Point the uncommented property at the appropriate directory.
For example, if your beehive installation resides at C:/apache/apache-beehive-1.0 and you have installed the JSF Reference Implementation, then your build.properties file would appear as follows.
beehive.home=C:/apache/apache-beehive-1.0 servlet-api.jar=${os.CATALINA_HOME}/common/lib/servlet-api.jar jsp-api.jar=${os.CATALINA_HOME}/common/lib/jsp-api.jar context.path=netui-jsf # TODO: # if using MyFaces, uncomment the 'myfaces.dir' property and set it to a directory that contains # myfaces.jar (MyFaces v1.0.9 or later). #myfaces.dir= # TODO: # If using the JavaServer Faces Reference Implementation, uncomment the 'jsf-ri.dir' property and # set it to a directory that contains jsf-api.jar and jsf-impl.jar (JSF RI v1.1_01). jsf-ri.dir=C:/java/jsf-1_1_01/lib
To Compile the Application
...If Using JSF Reference Implementation
If you are using the JSF Reference Implementation, enter the following Ant command:
ant -f C:\beehive_projects\netui-jsf\WEB-INF\src\build.xml clean build-jsf-ri war Copy and Paste version: ant -f C:\beehive_projects\netui-jsf\WEB-INF\src\build.xml clean build-jsf-ri war
...If Using MyFaces
If you are using MyFaces, enter the following Ant command:
ant -f C:\beehive_projects\netui-jsf\WEB-INF\src\build.xml clean build-myfaces war Copy and Paste version: ant -f C:\beehive_projects\netui-jsf\WEB-INF\src\build.xml clean build-myfaces war
Both of these targets build a WAR file and save it to:
C:/beehive_projects/netui-jsf.war
To Start Tomcat
To start Tomcat, run the following command:
%CATALINA_HOME%\bin\startup.bat
To Deploy to Tomcat
To deploy the samples, copy the WAR file to Tomcat's webapps directory.
copy C:\beehive_projects\netui-jsf.war %CATALINA_HOME%\webapps /Y
Running
To browse the JSF sample, visit the following link in a browser: