2010/01/11 - Apache Beehive has been retired.

For more information, please explore the Attic.

Apache > Beehive

NetUI: JSF Integration


This sample shows how to integrate JSF (Java Server Faces) into your NetUI web app; specifically, how to use JSF pages as the View tier with NetUI Page Flow as the Controller tier. 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:


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.

<BeehiveRoot> refers to the top-level directory of your Beehive installation. A typical value for <BeehiveRoot> would be /apache/apache-beehive-1.0.

The following instructions assume that you have copied the folder netui-jsf into the directory /beehive_projects, resulting in the following directory structure.

Strictly speaking, you do not need to copy the netui-jsf directory to another location. If you wish to leave the netui-jsf directory in place, in the instructions below you must replace occurrences of the path element /beehive_projects with this path element: <BeehiveRoot>/samples.

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 /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 /apache/apache-beehive-1.0 and you have installed the JSF Reference Implementation, then your build.properties file would appear as follows.




# if using MyFaces, uncomment the 'myfaces.dir' property and set it to a directory that contains
# myfaces.jar (MyFaces v1.0.9 or later).

# 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).
Windows users must use forwardslashes (/) not backslashes (\) in the build.properties file.

To Compile the Application

...If Using JSF Reference Implementation

If you are using the JSF Reference Implementation, enter the following Ant command:

  -f /beehive_projects/netui-jsf/WEB-INF/src/build.xml

Copy and Paste version:
ant -f /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:

  -f /beehive_projects/netui-jsf/WEB-INF/src/build.xml

Copy and Paste version:
ant -f /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:


To Start Tomcat

To start Tomcat, run the following command:


On non-Windows systems:


To Deploy to Tomcat

To deploy the samples, copy the WAR file to Tomcat's webapps directory.

On Windows:

copy C:\beehive_projects\netui-jsf.war %CATALINA_HOME%\webapps /Y

Everywhere else:

cp /beehive_projects/netui-jsf.war $CATALINA_HOME/webapps


To browse the JSF sample, visit the following link in a browser: