struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Carr <james.r.c...@gmail.com>
Subject Re: [S2] Accessing objects in the Spring context?
Date Wed, 09 Sep 2009 01:32:19 GMT
Couldn't I just make it ApplicationContextAware?

On Tue, Sep 8, 2009 at 8:27 PM, Musachy Barroso<musachy@gmail.com> wrote:
> WebApplicationContextUtils.getRequiredWebApplicationContext(ServletActionContext.getServletContext());
>
> On Tue, Sep 8, 2009 at 6:12 PM, James Carr<james.r.carr@gmail.com> wrote:
>> I can try it out... how can I make the bean factory available to my interceptor?
>>
>> Thanks,
>> James
>>
>> On Tue, Sep 8, 2009 at 6:12 PM, Wes Wannemacher<wesw@wantii.com> wrote:
>>> I guess I sort of misunderstood your problem. Another approach would
>>> be to retrieve the beans in an interceptor and push them onto the
>>> value stack. As long as you give them a name they should be available
>>> from the view. This approach will keep you from changing any of the
>>> action code. If you want to get really tricky you could try to figure
>>> out a declarative way to indicate which beans you want, per action
>>> invocation. I would whip up a quick example but I'm on my phone, maybe
>>> later tonight if no one else steps to the challenge.
>>>
>>> On 9/8/09, James Carr <james.r.carr@gmail.com> wrote:
>>>> Yeah, I was looking for a way around it... these are simple hash maps
>>>> that are used to display select options. I wound up with an action
>>>> with 5 Maps in it :(
>>>>
>>>> Thanks,
>>>> James
>>>>
>>>> On Tue, Sep 8, 2009 at 4:26 PM, Wes Wannemacher<wesw@wantii.com> wrote:
>>>>> You could use the @Autowire annotation directly on a property... But
I
>>>>> don't really see how that is better than using setter-based injection.
>>>>> Just because the beans are singletons doesn't mean anything special,
>>>>> you still need a reference to them in your struts action.
>>>>>
>>>>> -Wes
>>>>>
>>>>> On Tue, Sep 8, 2009 at 5:13 PM, James Carr<james.r.carr@gmail.com>
wrote:
>>>>>> I have several singleton based beans defined in my
>>>>>> applicationContext.xml and I'd like to just use these rather than
>>>>>> being forced to set them on my action. is there any way to accomplish
>>>>>> this?
>>>>>>
>>>>>> Thanks,
>>>>>> James
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>>>>> For additional commands, e-mail: user-help@struts.apache.org
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Wes Wannemacher
>>>>>
>>>>> Head Engineer, WanTii, Inc.
>>>>> Need Training? Struts, Spring, Maven, Tomcat...
>>>>> Ask me for a quote!
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> 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
>>>>
>>>>
>>>
>>>
>>> --
>>> Wes Wannemacher
>>>
>>> Head Engineer, WanTii, Inc.
>>> Need Training? Struts, Spring, Maven, Tomcat...
>>> Ask me for a quote!
>>>
>>> ---------------------------------------------------------------------
>>> 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
>>
>>
>
>
>
> --
> "Hey you! Would you help me to carry the stone?" Pink Floyd
>
> ---------------------------------------------------------------------
> 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