struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Micael Carreira <mcarre...@itclinical.com>
Subject Context parameters not being ignored?
Date Thu, 20 Dec 2018 19:24:50 GMT
Hello,

I'm using Struts2 with Spring. I have the following action:

     SomeAction
       |- FooService

But in my bean definition I don't have the FooService dependency because 
SomeAction doesn't use it:

     <bean id="someAction" class="SomeAction" scope="prototype" />

(Putting it this way doesn't make much sense, the real configuration is 
more complex than this, but this is the simplest example on how the 
problem can be reproduced)

Then my struts.xml redirects to a jsp result:

     <action name="SomeAction*" method="{1}" class="someAction">
         <result>/jsp/some.jsp</result>
     </action>


And some.jsp calls other action:

     <s:action name="OtherAction" var="other" executeResult="false" 
ignoreContextParams="true"></s:action>

But OtherAction actually needs FooService as a dependency, and its bean 
definition reflects that:

     <bean id="otherAction" class="OtherAction" scope="prototype">
         <property name="fooService" ref="fooService" />
     </bean>

I noticed that when OtherAction gets instantiated through jsp parsing, 
it first gets set with the correct fooService dependency.

However, after that, fooService then gets set with null. So OtherAction 
won't be able to correctly run.

I already assessed that the second injection is the value that is 
present in SomeAction.

But I don't want this value injected. It shouldn't be injected if I'm 
running OtherAction with ignoreContextParams="true", right?

I have been all day around this problem, so any help would be much 
appreciated.

Cheers,
Micael


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message