[
https://issues.apache.org/struts/browse/STR-3009?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_40333
]
Michael Jouravlev commented on STR-3009:
----------------------------------------
>> In regards to ActionRedirect, should not redirect/forward be defined
>> in the config file after all? Was not it an original intent of Struts
>> to externalize configuration?
>>
> You can't really just change a config file and have that dictate this
> particular behavior. How the action is written can depend on whether
> you're planning to redirect or forward. If you're redirecting, you modify
> the outgoing URL; if you're forwarding, you put your data in request
> attributes. (Well, that's one way to do it.)
Right. When you want to send additional data to the target location, you either
queue it into request object for forward, or add to URL for redirect. Well, one
can also use session as temporary storage for redirect as well, but in this
case no parameters are passed.
So, ActionMapping can accept parameters along with mapping name, and depending
on mapping configuration (redirect of forward) perform an appropriate parameter
packing, either sticking them into request or adding them to URL. Seems clean
and simple to me.
> ActionRedirect's redirect attribute wasn't intended to be configurable.
> I wouldn't recommend that an Action use ActionRedirect if the intention
> is to do a forward. Just because we can do it that way doesn't make it
> right.
>
> I agree with Jason that the change in behavior broke backward compatibility
> and should be considered a bug.
I guess I can agree with this. What do you think about new feature of
ActionMapping described above? We can even pass redirect flag. Basically, if
ActionMapping.findForward is called with name only it will return a frozen
instance of ActionForward, otherwise it will create a new instance on the fly,
with optional parameters and redirect flag. The URL parameters can be sent as a
separate parameter object, this code can pulled out of ActionRedirect class.
> ActionRedirect from ForwardConfig not redirecting properly?
> -----------------------------------------------------------
>
> Key: STR-3009
> URL: https://issues.apache.org/struts/browse/STR-3009
> Project: Struts 1
> Issue Type: Bug
> Components: Core
> Affects Versions: 1.3.5, 1.3.6
> Reporter: Jason Millard
>
> While migrating from Struts 1.2.9 to Struts 1.3.5, I noticed ActionRedirect
> was no longer redirecting as expected.
> In the Struts 1.2.9, in
> public ActionRedirect(ForwardConfig baseConfig)
> setRedirect was always being set to TRUE, like it is in every other
> constructor.
> However, as of Struts 1.3.5 it is now being configured as
> setRedirect(baseConfig.getRedirect());
> This seems to defeat the purpose of a ActionRedirect if you are trying to
> generate one from a
> mapping.findForward();
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.