struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Micael Carreira <mcarre...@itclinical.com>
Subject Re: Context parameters not being ignored?
Date Wed, 02 Jan 2019 15:07:11 GMT
Sorry for the delay in replying, I was on holidays. By the way, have a 
happy new year :)

Here is the stack trace of both injections:
https://pastebin.com/6wMpWK8a

Cheers,
Micael

On 22/12/18 08:19, Yasser Zamani wrote:
> Hi Micael,
>
> I think putting a breakpoint on OtherAction.setFooService and probing the full stack
trace when the execution hits it for second time would help to reveal what and who's the villain
of second injection :)
>
> Regards.
>
>> -----Original Message-----
>> From: Micael Carreira <mcarreira@itclinical.com>
>> Sent: Thursday, December 20, 2018 10:55 PM
>> To: user@struts.apache.org
>> Subject: Context parameters not being ignored?
>>
>> 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
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org

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


Mime
View raw message