Details
-
Improvement
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
Nightly Build
-
None
-
Operating System: other
Platform: Other
-
19945
Description
Here's the part that explains Action chaining and why it is discouraged. Please
feel free to make changes to this.
— newbie-old.xml Thu May 15 00:38:35 2003
+++ newbie.xml Thu May 15 00:48:19 2003
@@ -44,6 +44,10 @@
<a href="#actionFormInterface">Why is ActionForm a base class rather than a
n interface?</a>
</li>
+ <li>
+ <a href="#actionChaining">How can I 'chain' Actions?</a>
+ </li>
+
<li>
<a href="#multiple">Can I use multiple HTML form elements with the same
name?</a>
@@ -272,6 +276,16 @@
</p>
</section>
+<section href="actionChaining"
+ name="How can I 'chain' Actions?">
+ <p>
+ There are several ways: you can specify your *.do's as inputs in the str
uts-config.xml file or you can return a new ActionForward object in your Action
class. However, it is not recommended to do this because you would be introducin
g business logic into the Action layer. This would impact the scalability of you
r application. If you have to do this, it would likely suggest that the Action a
nd business layers are too tightly coupled in your design. An Action should just
invoke methods from the business object.
+ <pre/>
+ If you do decide to chain Actions, be aware of the following: calling th
e second Action from the first Action has the same effect as calling the second
Action from scratch. If both of your Actions change the properties of
+ a formbean, the changes made by the first Action will be lost because St
ruts calls the reset() method on the formbean when the second Action is called.
+ </p>
+</section>
+
<section href="JavaBeans" name="Do ActionForms have to be true JavaBeans?">
<p>
The utilities that Struts uses (Commons-BeanUtils since 1.1) require that Actio
nForm properties follow
@@ -944,8 +958,6 @@
<li>Why can't I disable URL-encoding in the Struts taglibs?</li>
<li>How can I create a "wizard" workflow?</li>
-
- <li>How can I "chain" Actions?</li>
<li>Can I have an Action without a form?</li>