How to setup a basic Struts project using NetBeans IDE 4.0
* DISCLAIMER - This simple How-To shows you how easy it is to
use NetBeans IDE 4.0 to write code for the Struts
Action Framework. It just works straight out of the box.
Simply specify where your sources are
and where you want to store your application, and NetBeans IDE
4.0 does everything
you need -- it even generates a customized Ant build script
for you and hooks its targets
up to IDE commands such as "Build" and "Run".
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.
Let's get started
You will use wizards to set up and deploy the struts-mailreader in
Before we begin, let's create (or reuse) a folder to hold the
project. Copy the struts-mailreader.war
from the Struts Applications distribution and extract it, with the
result that it looks like this:
Create a new project.
The New Project wizard appears. Select "Web Project with
Do this when you want to use your own sources to create a
web application, but
you want the IDE to generate an Ant build script for you.
Specify the location of your sources, the location of your
new IDE project, and a project name.
Drill-down further and specify the location of your web
pages, Java sources, and libraries,
and decide whether you want your application to support
J2EE 1.4 or J2EE 1.3.
Now click Finish. That's it! You're done.
Let's take a look at the result in the Projects window,
and notice how
the Source Editor provides JSP code completion for Struts
JSP tag libraries:
Note that code completion for the struts-config.xml file
if you have Internet access. If you use a proxy, it must
be enabled. If you
do not have Internet access, you can use the IDE to create
an OASIS XML Catalog,
which enables code completion for the struts-config.xml
Now take a look in the Files window and browse through the
Ant build script that the IDE made for you:
Finally, run the Mailreader application. Right-click the
project node in the Projects window
and choose Run Project.
The Run Project command is hooked to the Run target in the
IDE-generated Ant script.
The Run target depends on targets that compile the
application, deploy it to the IDE's
default server, and display it in the IDE's default
So, when you choose "Run Project", the IDE uses the Ant
build script to compile, deploy, and display it!