[ 
https://issues.apache.org/jira/browse/WW-3647?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Miguel Almeida updated WW-3647:
-------------------------------

    Attachment: redirectActionErrorTest.zip

To see the problem:

1) run the maven goal jetty:run
2) browse to http://localhost:8080
3) Write "issue" on the top form and submit

Expected:
- The action has an "if issue, return login". Login has a global redirectAction 
result to index. I'd expect the action to redirect do index, which in turn 
redirects to /jsp/index.jsp

Actual:
What was expected

CHANGE:
1) Now change type="myRedirect" to type="redirectAction" in struts.xml. This 
will make Struts use the same ServletActionRedirectResult, but now it's not 
being managed by Spring.

Actual:
Error - Problem accessing /zzz/index!zzz.action.
It seems Struts is injecting zzz (the default value of the jdni bean) 
everywhere in ServletActionRedirectResult's constructor!

> Adding a jndi-lookup Spring bean breaks ServletActionRedirectResult
> -------------------------------------------------------------------
>
>                 Key: WW-3647
>                 URL: https://issues.apache.org/jira/browse/WW-3647
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Dispatch Filter, Plugin - Spring
>    Affects Versions: 2.2.3
>            Reporter: Miguel Almeida
>              Labels: injection, redirectAction, spring, struts2
>         Attachments: redirectActionErrorTest.zip
>
>
> When you add the following bean to a Spring-Struts application:
> <jee:jndi-lookup jndi-name="someName" id="currentEnvironment" 
> default-value="XXXX"  />
> Whenever you have an action with a redirectAction type, Struts will try to 
> redirect you to:
> http://localhost:8080/XXXX/index!XXXX.action#XXXX
> This happens because the 3 String argument constructor for 
> ServletActionRedirectResult will set action, method and namespace to whatever 
> value is defined for that bean (XXXX in the example, if you don't have a 
> someName JDNI property).
> This only happens when you let struts manage ServletActionRedirectResult. If 
> you add the following Spring bean:
>       <bean id="myRedirect" 
> class="org.apache.struts2.dispatcher.ServletActionRedirectResult"
>               scope="prototype" autowire="byName">
>       </bean>
> and add a                     <result-type name="myRedirect"  
> class="myRedirect" /> result type, the problem doesn't appear.
> I've added a testCase for you to confirm.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to