Java Reference
In-Depth Information
that are called are reduced in their complexity. Normally, you would need to have
a signature that receives an
HttpServletRequest
, an
HttpServletResponse
, an
ActionForm
, and an
ActionMapping
. The
Action
execute method also requires that
you return an
ActionForward
. The
BeanAction
reduces all this by simply requiring
an empty signature with a String as a return value. Third, it is far easier to unit-test
a simple bean than it is to unit-test an
ActionForm
and an
Action
. Testing Struts
Action
classes is thoroughly possible with the use of
MockObject
s and or
Struts-
TestCase
. However, it is quite a bit easier to test a simple bean. Finally, since the
BeanAction
architecture works seamlessly with existing Struts applications, it allows
you to migrate your application architecture to a modern approach without destroy-
ing all of your previous hard work.
14.4
L
aying the foundation
Now let's set up our development environment. We won't concentrate on specific
tools to use for the development of an i
BATIS
-enabled application, but we'd like
to take some time to provide a basic structure that has been useful for us. Organiz-
ing your source tree is an important part of writing good, clean, and simple code.
If you'd like, you can use the source in the i
BATIS
JGameStore application to fol-
low along with the rest of this chapter. We won't be able to cover all of the require-
ments we specified previously. However, if you examine the i
BATIS
JGameStore
application's source, you will be able to examine the code we did not cover and
understand what is going on.
Let's start by creating a base folder called jgamestore. This will be your project
folder and will contain your source tree. You can set this folder up in your favorite
IDE
and name the project jgamestore, or you can simply do this manually from
the
OS
. Below the project folder create several folders: src, test, web, build, devlib,
and lib:
/jgamestore
/src
/test
/web
/build
/devlib
/lib
Let's take a close look at each of these folders.
14.4.1
src
The name
src
is short for source. The src folder will hold all Java source code and
any property or
XML
files that must exist on the classpath. These files will be used


