<?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>NetUI Project Template</title>
    </header>
    <body>
        <section id="intro">
            <title>Introduction</title>
            <p>
            NetUI enabled web applications require a set of JARs, XML configuration files, and <code>web.xml</code> entries.  
            In order to make it easy to get started with a NetUI web application, the <code>samples/netui-blank</code> project
            template is available in the Beehive distribution.  Use this as a starting point for building new NetUI-enabled
            applications.  This document describes how to build a new NetUI-enabled application from the <code>netui-blank</code> 
            project template.
            </p>
            <note>
            In the documentation below, &lt;beehive-root> refers to the top-level directory of your local Beehive installation.  
            A typical value for &lt;beehive-root> would be <code>/apache/apache-beehive-1.0</code>.
            </note>
        </section>
        <section id="using">
            <title>Using the NetUI Webapp Template</title>
            <p>
            The following instruction assume that you have completed all of required and optional steps in the Beehive set up procedure at 
            <a href="site:setup">Installation and Setup</a>.
            </p>
            <p>
            To use the <code>netui-blank</code> template, follow these steps:
            </p>
            <section id="copyAndRename">
                <title>Create a New Webapp</title>
                <p>
                A new NetUI web project can be created by running the following Ant command from <code>&lt;beehive-root</code>:
                </p>
                <source>ant -f beehive-imports.xml new.netui.webapp</source>
                <p>
                This will prompt you for a fully-qualified path for your web project.  For example, the following path 
                <code>/projects/fooWeb</code> would create a project layout similar to that described 
                <a href="site:sourceOut">here</a>.
                This project will include the runtime, configuration files / entries, and a basic Ant build.xml file.
                The description below assumes that you have created the NetUI-enabled web project <code>fooWeb</code> under a
                <code>projects/</code> directory.
                </p>
            </section>            
            <section id="configureProperties">
                <title>Configure the Webapp's Build Properties</title>
                <p>
                In this section you will edit the <code>build.properties</code> file in order to set build-related
                paths and values for your web project.
                </p>
                <p>
                Open the file <code>/projects/fooWeb/build.properties</code> in a text editor and edit the following
                properties:
                </p>
                <ul>
                <li>Set the <code>beehive.home</code> property to point to the top-level folder of your Beehive installation.</li>
                <li>
                Set the <code>context.path</code> property to some value that is appropriate to your web application.  This
                value is used when the web-project is built into a <code>.war</code> archive.  When deploying the 
                <code>.war</code> archive, it also often determines thecontext path for the web project when deployed to the server.
                </li>
                </ul>
                <p>
                For example, if Beehive is installed at <code>/apache/apache-beehive-1.0</code>, and you created a project named 
                <code>fooWeb</code> then your <code>build.properties</code> file might appear as follows:
                </p>
<source>beehive.home=<strong>/apache/apache-beehive-1.0</strong>

servlet-api.jar=${os.CATALINA_HOME}/common/lib/servlet-api.jar
jsp-api.jar=${os.CATALINA_HOME}/common/lib/jsp-api.jar

context.path=<strong>fooWeb</strong></source>
                <note>
                Properties files should use the '/' character to separate drive, directory, and file names.
                </note>
                <note>
                This <code>.properties</code> file also assumes that you are using Tomcat as your Servlet container.  
                If you are not using Tomcat, set the paths to the Servlet and JSP API classes appropriately for your
                container.  In some cases, these may point to the same JAR.
                </note>
            </section>
            <section id="build">
                <title>Build the Webapp</title>
                <p>
                By default, the build associated with a new NetUI-enabled webapp stores the Ant <code>build.xml</code> file
                in the project's root directory; in the example above, this is the <code>projects/fooWeb</code> directory. 
                </p>
                <p>
                To build the webapp, run <code>ant build</code>.  This will create a <code>build/</code>
                directory into which the webapp's resources are copied and Java source files are compiled.  This 
                <code>build</code> directory will be archived when creating a <code>.war</code> file.  It can also
                be deployed, exploded directly to the server.
                </p>
                <p>
                To clean the webapp, run <code>ant clean</code>.  
                </p>
                <p>
                To create a <code>.war</code> file, run <code>ant war</code>.
                </p>
                <p> 
                To update the JSPs when doing iterative development, run <code>ant copy.jsps</code>.
                </p>  
            </section>
            <section id="deployAndRun">
                <title>Deploy and Run the Webapp</title>
                <p>
                If you are using Tomcat, the web application can be deployed by copying the built <code>.war</code> file 
                from <code>projects/fooWeb/fooWeb.war</code> to Tomcat's <code>webapps</code> directory.
                </p>
                <p>
                If you are using a different Servlet container, follow your container's deployment instructions for deploying
                a <code>.war</code> web projct arcive.
                </p>
                <p>
                Once the web application is deployed, you can run your web application by accessing the following URL from
                a browser: http://localhost:8080/<strong>fooWeb</strong>/ . You should see a page with the text "New Web
                Application Page".
                </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-2005, Apache Software Foundation
        </legal>
    </footer>
</document>
