At 1:07 PM -0500 5/16/06, Joe Germuska wrote:
I've uncovered a couple of things in porting an old Struts 1.1 application to 1.3; I know they probably need to go in Jira, but I wanted to get a little discussion about them before filing them. Actually, now I think i'll send them separately with different subject lines to help manage the various conversations that might arise...

One thing we found was that the action mapping below worked in Struts 1.1 but not in Struts 1.3:

                <action
                        path="/Homepage"
                        type="org.apache.struts.actions.ForwardAction"
                        forward="HOMEPAGE" />

Apparently, Struts 1.1 favored the "forward" over the "type" so that this was forwarded to "HOMEPAGE" before ForwardAction was executed. In Struts 1.3, the "type" is favored, so that the ForwardAction was executed, triggering an exception because no "parameter" attribute was defined.

(The mapping above, then, is simply misguided, but the developer who used it saw the desired results and never looked back.)

In Struts 1.3, it had to be changed to this:

                <action
                        path="/Homepage"
                        type="org.apache.struts.actions.ForwardAction"
                        parameter="HOMEPAGE" />

which has the same net effect.

I don't understand why we even have a ForwardAction when you can achieve the same with the "forward" attribute. This would be equivalent to both of the above:

                <action
                        path="/Homepage"
                        forward="HOMEPAGE" />

So, then, we have the question of whether this difference in behavior constitutes a bug in Struts 1.3, or simply something which should be documented in migration notes and kept in our collective answer-boxes should the question come up on struts-user. (We could also consider deprecating ForwardAction, unless someone can explain its use to me; I'm guessing it's just five years old and was a "good idea at the time")

For this one, my vote is "should be documented"; I don't think there's any one-true-way to handle conflicting configuration and I don't think it was ever documented anywhere before that "forward" trumps "type".

If anyone would like to take a stab at documenting this, I'm way behind after all the time I had to spend debugging this and some other issues related to making this move (including using third party libraries with dependencies on things removed and no source code to be found, oy!)

Joe

--
Joe Germuska
[EMAIL PROTECTED] * http://blog.germuska.com
"You really can't burn anything out by trying something new, and
even if you can burn it out, it can be fixed.  Try something new."
        -- Robert Moog

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to