<?xml version="1.0"?>
<!--
    $Id$

    Licensed to the Apache Software Foundation (ASF) under one or more
    contributor license agreements.  See the NOTICE file distributed with
    this work for additional information regarding copyright ownership.
    The ASF licenses this file to You under the Apache License, Version 2.0
    (the "License"); you may not use this file except in compliance with
    the License.  You may obtain a copy of the License at
   
         http://www.apache.org/licenses/LICENSE-2.0
   
    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
-->
<!--
// ======================================================================== 78
-->
<document>

    <properties>
        <title>How to setup a basic Struts project using
            NetBeans IDE 4.0</title>
    </properties>

    <body>

        <section href="netbeans"
                 name="How to setup a basic Struts project using NetBeans IDE 4.0"/>
        <section name="Legal Disclamer">

            Please read
            <a href="http://jakarta.apache.org/site/idedevelopers.html">
                this</a>
            first.
            <br/>
            <p>
                * DISCLAIMER - This simple How-To shows you how easy it is to
                use NetBeans IDE 4.0 to write code for the Struts
                <br/>
                Action Framework. It just works straight out of the box. 
                Simply specify where your sources are
                <br/>
                and where you want to store your application, and NetBeans IDE
                4.0 does everything
                <br/>
                you need -- it even generates a customized Ant build script
                for you and hooks its targets
                <br/>
                up to IDE commands such as "Build" and "Run".
                <br/>
                <br/>
                This is mainly geared toward Struts users who are new to
                NetBeans IDE 4.0, and don't want to spend
                a lot of time figuring out the differences between their old
                IDE and this one.
                <br/>
            </p>
        </section>

        <section name="Let's get started">

            You will use wizards to set up and deploy the struts-mailreader in
            5 steps.
            <br/>
            <br/>
            Before we begin, let's create (or reuse) a folder to hold the
            project. Copy the struts-mailreader.war
            <br/>
            from the Struts Applications distribution and extract it, with the
            result that it looks like this:
            <br/>
            <br/>
            <img alt="" src="../images/how-to/netbeans4/directory.jpg"></img>
            <br/>
            <br/>
            <br/>
            <ol>
                <li>
                    Create a new project.
                    <br/>
                    <br/>
                    <img alt=""
                         src="../images/how-to/netbeans4/creating-project3.jpg"></img>
                    <br/>
                    <br/>
                    <br/>
                </li>
                <li>
                    The New Project wizard appears. Select "Web Project with
                    Existing Sources".
                    <br/>
                    Do this when you want to use your own sources to create a
                    web application, but
                    <br/>
                    you want the IDE to generate an Ant build script for you.
                    <br/>
                    <br/>
                    <img alt=""
                         src="../images/how-to/netbeans4/creating-project4.jpg"></img>
                    <br/>
                    <br/>
                    <br/>
                </li>
                <li>
                    Specify the location of your sources, the location of your
                    new IDE project, and a project name.
                    <br/>
                    <br/>
                    <img alt=""
                         src="../images/how-to/netbeans4/creating-project5.jpg"></img>
                    <br/>
                    <br/>
                    <br/>
                </li>
                <li>
                    Drill-down further and specify the location of your web
                    pages, Java sources, and libraries,
                    <br/>
                    and decide whether you want your application to support
                    J2EE 1.4 or J2EE 1.3.
                    <br/>
                    <br/>
                    <img alt=""
                         src="../images/how-to/netbeans4/creating-project6.jpg"></img>
                    <br/>
                    <br/>
                    <br/>
                    <br/>
                    Now click Finish. That's it! You're done.
                    <br/>

                    Let's take a look at the result in the Projects window,
                    and notice how
                    <br/>
                    the Source Editor provides JSP code completion for Struts
                    JSP tag libraries:
                    <br/>
                    <br/>
                    <img alt=""
                         src="../images/how-to/netbeans4/creating-project7.jpg"></img>
                    <br/>
                    <br/>
                    Note that code completion for the struts-config.xml file
                    works automatically
                    <br/>
                    if you have Internet access. If you use a proxy, it must
                    be enabled. If you
                    <br/>
                    do not have Internet access, you can use the IDE to create
                    an OASIS XML Catalog,
                    <br/>
                    which enables code completion for the struts-config.xml
                    file.
                    <br/>
                    <br/>

                    Now take a look in the Files window and browse through the
                    Ant build script that the IDE made for you:
                    <br/>
                    <br/>
                    <img alt=""
                         src="../images/how-to/netbeans4/creating-project8.jpg"></img>
                    <br/>
                    <br/>
                    <br/>
                </li>
                <li>
                    Finally, run the Mailreader application. Right-click the
                    project node in the Projects window
                    <br/>
                    and choose Run Project.
                    <br/>
                    <br/>
                    The Run Project command is hooked to the Run target in the
                    IDE-generated Ant script.
                    <br/>
                    The Run target depends on targets that compile the
                    application, deploy it to the IDE's
                    <br/>
                    default server, and display it in the IDE's default
                    browser.
                    <br/>
                    <br/>
                    So, when you choose "Run Project", the IDE uses the Ant
                    build script to compile, deploy, and display it!
                    <br/>
                    <br/>
                    <img alt=""
                         src="../images/how-to/netbeans4/creating-project9.jpg"></img>
                    <br/>
                    <br/>
                    <br/>
                    <img alt=""
                         src="../images/how-to/netbeans4/page.jpg"></img>
                    <br/>
                    <br/>
                    <br/>
                </li>

            </ol>

        </section>

        <section name="Let's set up a blank application">
            Now you will use wizards to set up a new Struts
            application in NetBeans IDE 4.0, again in 5 steps.
            <br/>
            <br/>
            <ol>
                <li>
                    Create a new project.
                    <br/>
                    <br/>
                    <img alt=""
                         src="../images/how-to/netbeans4/creating-project3.jpg"></img>
                    <br/>
                    <br/>
                    <br/>
                </li>
                <li>
                    The New Project wizard appears. Select "Web Application".
                    <br/>
                    <br/>
                    <img alt=""
                         src="../images/how-to/netbeans4/new-project1.jpg"></img>
                    <br/>
                    <br/>
                    <br/>
                </li>
                <li>
                    Specify the location of your new IDE project and a project
                    name,
                    <br/>
                    and decide whether you want your application to support
                    J2EE 1.4 or J2EE 1.3.
                    <br/>
                    <br/>
                    <img alt=""
                         src="../images/how-to/netbeans4/new-project2.jpg"></img>
                    <br/>
                    <br/>
                    <br/>
                    Now click Finish.
                    <br/>
                    <br/>
                    <br/>
                </li>
                <li>
                    Right-click the blank-struts-app node in the Projects
                    window and choose Properties.
                    <br/>
                    Select Compiling Sources, click Add JAR/Folder and add the
                    libraries from the Struts distribution:
                    <br/>
                    <br/>
                    <img alt=""
                         src="../images/how-to/netbeans4/new-project3.jpg"></img>
                    <br/>
                    <br/>
                    <br/>
                    Click OK.
                    <br/>
                    Now go to the distribution for the struts-blank
                    application on your filesystem.
                    <br/>
                    <ul>
                        <li>Copy the struts-config.xml, tlds, and all the
                            other configuration files (except the web.xml
                            file)
                            <br/>
                            from the WEB-INF folder and paste them into your
                            web/WEB-INF folder.
                        </li>
                        <li>Copy MessageResources.properties from
                            WEB-INF/classes/resources into your src
                            folder.</li>
                    </ul>
                    <br/>
                    <br/>
                    <br/>
                </li>
                <li>
                    Test your new Struts functionality in the Source Editor:
                    <br/>
                    <br/>
                    <img alt=""
                         src="../images/how-to/netbeans4/new-project4.jpg"></img>
                    <br/>
                    <br/>
                    <br/>
                    <br/>
                </li>
            </ol>

            <p>For further information, see:</p>
            <ul>
                <li>What's New in NetBeans IDE 4.0 (
                    <a href="http://www.netbeans.org/community/releases/40/whats-new-40.html">
                        http://www.netbeans.org/community/releases/40/whats-new-40.html</a>
                    )
                </li>
                <li>Using NetBeans IDE 4.0 (
                    <a href="http://www.netbeans.org/kb/using-netbeans/40/index.html">
                        http://www.netbeans.org/kb/using-netbeans/40/index.html</a>
                    )
                </li>
            </ul>

        </section>
    </body>
</document>
