struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Denis Cabasson <>
Subject Re: Some Spring/Struts questions
Date Wed, 12 May 2010 12:22:39 GMT

> A new requirement means that we need to have available across pretty much
> every action a separate, independent bean that carries information that may
> (or may not) need to be displayed on the resulting web-pages. I am wondering
> what the best way is to make this bean available to each JSP.
We have a case which is pretty much like that. We have decided to use a 
static property in a configuration class to hold this instance. OGNL 
works pretty nicely with static members, using syntax. We are injecting this bean onto the 
static member using the MethodInvokingFactoryBean (see
> I'm happy with injecting certain beans into certain actions, but I'm not
> clear what I should be injecting *this* bean into. Ideally it should just
> pop into existence and be available to the JSPs without the Actions even
> being aware that it is there. It's not part of the business logic and is
> purely informational. If I have to make it available through the Actions
> then I would *like* to be able to inject it into the common base class with
> a single configuration and have that work automatically for all sub-classes
> (and this would be a useful trick for some other places in the application)
> but that does not seem to be possible unless I'm missing a trick?
That's actually possible. We are doing that type of things by using the 
@Autowired annotation, which means that spring needs to find a suitable 
bean to inject there. If you put that annotation on your base class, the 
instance will get injected in all sub-classes. But in that case, it's 
better for the actions to be unaware of that, so I would using the 
static approach. Otherwise, you could use an interceptor to push that 
object on to the stack.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message