Question

I am having a weird problem when redirecting to an action from another action. In short the named variable captured in the first action (from which I am redirecting) is still preserved somehow in the value stack and it is overwriting the same named variable in the second action. I will explain via some code.

<action name="r/{seoURL}" class="ReportsAction"
    method="displayReport">
    ...
    <result name="REDIRECT_TO_NEXT_ACTION" type="redirectAction">
        <param name="actionName">s/${seoURLForRedirect}</param>
        <param name="namespace">/reports</param>
    </result>
    ...
</action>

I am setting the variable ${seoURLForRedirect} in ReportsAction before returning. I have the following mapping for the second action.

<action name="s/{seoURL}" class="ReportSeriesAction"
    method="displayReportSeries">
    ...
</action>

As you can see I have same named variable in my second action seoURL. This value is set to the value as found in the first action. I fail to understand why is the value stack still maintaining seoURL value set in the first action. Especially since I am over writing it in my redirect result params.

Any help appreciated.

Was it helpful?

Solution

Based on your class action attribute, I'm assuming you're using the Spring plugin.

Actions must be declared as scope="prototype"/non-singleton to be instantiated per-request.

If they're not, you're using a singleton, and properties will be maintained across requests.

I've never tried to set a redirectAction's actionName to a wildcard that points to another wildcarded action, so I'm not sure about the second part of the question.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top