Java Reference
In-Depth Information
service classes. The i
BATIS
DAO
will also be used for transaction demarcation so
that we can aggregate fine-grained calls against the persistence layer.
14.2.3
Persistence
We're sure it won't surprise you that we plan to use i
BATIS
SQLMap
s in the persis-
tence layer. i
BATIS
SQLMap
s will fulfill the responsibility of managing
SQL
, persis-
tence caches and executing calls against the database. We'll avoid going into too
much detail about this since this is a topic on the very subject.
14.3
T
weaking Struts: the BeanAction
Recently, web application frameworks have experienced a bit of a transformation.
Features like state management, bean-based presentation classes, enhanced
GUI
components, and sophisticated event models have been introduced to make
development easier. Even in the midst of these next-generation frameworks,
Struts continues to enjoy a strong presence. In assessing the best approach for the
JGameStore application, we wanted to use Struts while keeping a forward rele-
vance to the new-generation frameworks. With this in mind, we decided to use an
approach that we have dubbed the
BeanAction
. The
BeanAction
allows developers
of standard Struts applications to easily grasp how i
BATIS
fits into a standard
Struts application. At the same time, developers who use next-generation frame-
works like
JSF
, Wicket, and Tapestry will understand the semantics of the
BeanAc-
tion
approach. In the end, we are not trying to make Struts different; we are
simply making our application relevant to a wider audience.
The
BeanAction
successfully flattens the responsibilities of the
Action
and
ActionForm
into one class. It also
abstracts you away from direct access
to the web-specific components like
session and request. This type of archi-
tecture is reminiscent of WebWork and
JSF
. This flattening is accomplished
through a few key components: the
BeanAction
that extends the Struts
Action
class, the
BaseBean
, and the
ActionContext
. These components are
important to understanding how the
BeanAction
works, and are illustrated
in figure 14.1.
BeanAction
BaseBean
ActionContext
AbstractBean
AccountBean
CatalogBean
CartBean
OrderBean
Figure 14.1
UML diagram of the BeanAction
architecture
















