Академический Документы
Профессиональный Документы
Культура Документы
While in Struts 2, an
Action class
implements an Action
interface, along with
other interfaces use
optional and custom
Struts1 extends the
services. Struts 2
abstract base class by
provides a base
its action class. The
Action ActionSupport class
problem with struts1
classes that implements
is that it uses the
commonly used
abstract classes rather
interfaces. Although an
than interfaces.
Action interface is not
necessary, any POJO
object along with an
execute signature can
be used as an Struts 2
Action object.
http://www.roseindia.net/struts/struts1-vs-struts2.shtml 10/31/2010
Struts1 vs Struts2 Page 2 of 4
Struts1 application
To test the Struts 2
has a major problem
Actions instantiate the
while testing the
Action, set the
application because
properties, and
Testability the execute method
invoking methods.
exposes the Servlet
Dependency Injection
API. Struts TestCase
also makes testing
provides a set of mock
easier.
object for Struts 1.
http://www.roseindia.net/struts/struts1-vs-struts2.shtml 10/31/2010
Struts1 vs Struts2 Page 3 of 4
Struts 2 uses a
ValueStack technology
to make the values
accessible to the taglibs
without coupling the
Struts 1 binds objects view to the object to
Binding
into the page context which it is rendering.
values into
by using the standard The ValueStack
views
JSP mechanism. strategy enables us to
reuse views across a
range of types, having
same property name
but different property
types.
Struts 1 ActionForm
properties are almost
http://www.roseindia.net/struts/struts1-vs-struts2.shtml 10/31/2010
Struts1 vs Struts2 Page 4 of 4
In Struts 2 different
Each module in Struts
lifecycles are created
1 has a separate
on a per Action basis
Control Of Request Processors
via Interceptor Stacks.
Action (lifecycles), while all
Custom stacks are
Execution the Actions in the
created and used with
module must share the
different Actions, as
same lifecycle.
required.s
http://www.roseindia.net/struts/struts1-vs-struts2.shtml 10/31/2010