Date: 2005-03-17T11:33:29
Editor: FrankZammetti
Wiki: Apache Struts Wiki
Page: StrutsMultipleActionForms
URL: http://wiki.apache.org/struts/StrutsMultipleActionForms
no comment
Change Log:
------------------------------------------------------------------------------
@@ -50,6 +50,19 @@
Another possible solution is the usage of the SetupItems proposal put forth by
Frank W. Zammeti. Although it is currently only for version 1.2.6, it is
another way to solve this problem, and one that gives you even more flexibility
besides. There are important considerations to using this though, and they are
documented on the Wiki page describing the solution. While I personally like
this solution (as do a number of others), it is VERY IMPORTANT that you
understand those considerations before choosing to use it.
+==== Rather than chain Actions, treat them as what they are: CLASSES! ====
+
+This is the solution I've found myself using most frankly... There has never
been anything to stop someone from instantiating an Action and calling
execute() on it manually. For some reason, when I talk to people and mention
this, they seem to think there is someting magical about Actions. Not! :)
+
+So, assume we have the "typical" organization of classes where for Page A
there is a setup Action (maybe literally called SetupActionA) and a
"processing" Action (ProcessActionA?), and the same organization for Page B...
Now, let's say we submit a form from Page A that fires the processing Action
for it. As a result, we want to move to Page B. Instead of forwarding to Page
B's setup Action, just do this at the end of Page A's processing Action:
+
+{{{
+SetupActionB sab = new SetupActionB();
+return sab.execute(m, f, req, rep);
+}}}
+
+That avoids the overhead of the forward while accomplishing the same thing.
The down-side to this is that Actions are no longer independant units, and
arguably you lose some of the declarative nature of Struts. Some Actions will
"know about" others, which is considered bad by most (me included, generally).
But, I agree with Dakota Jack that there doesn't seem to be a good, standard
way of doing this at this point, so every "hack" in use today has its pluses
and minuses, this one just like all the rest.
+
=== CONCLUSION ===
The result, I think, is that there is no way to handle the most common use
case in Struts. How weird is that?
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]