Using the DynaActionForm Class
Using the ActionForm
class has many advantages over performing the functionality yourself
in the Action
class or some set of helper utility
classes. Because the behavior the ActionForm
class
provides is needed in nearly every web application and often many
times in the same application, using the framework to perform the
work can really reduce the development time and your frustration
level. However, there are a few very important downsides to using
ActionForm
s.
The biggest problem with using
ActionForm
s is the
sheer number of classes that it can add to a project. Even if you
share ActionForm
definitions across many pages,
the additional classes make it more difficult to manage and maintain
a project. This is why some developers create a single
ActionForm
and implement the properties for all of
the HTML forms within it. The problem with this approach, of course,
is that combining the fields into one class makes it a point of
contention on a project that has more than just a few developers.
Another major liability is the requirement to define the properties
in the ActionForm
that need to be captured from
the HTML form. If a property is added or removed from the HTML form,
the ActionForm
class may need to be modified and
recompiled.
For these reasons, a new type of ActionForm
, which
is dynamic in nature and allows you to avoid having to create
concrete ActionForm
classes for your application,
was added to the framework. The dynamic ActionForm
is implemented ...
Get Programming Jakarta Struts, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.