I looked for something similar a while back and didn't find anything simple.
There are servlet context listeners (but that isn't really struts-2-ish).
What I did (and I know it's inelegant) is to create a static initializer
block. One main difference to remember between servlets and actions is
I could be wrong, but perhaps you should use the Spring IoC container for this.
I can't point you to the correct documentation off hand, but I believe that
this is the way to maintain a resource such as what you had previoulsy done
with the Servlet's init method and the factory class.
On 2/22/07, Wesley Wannemacher [EMAIL PROTECTED] wrote:
I looked for something similar a while back and didn't find anything
simple.
There are servlet context listeners (but that isn't really struts-2-ish).
I would strongly disagree that ServletContextListeners are not really
struts-2-ish.
I see a couple of options.
The first would be to create an interceptor for your singleton factory.
In the init of the interceptor you would initialize this factory and
then provide some mechanism to inject that factory into your actions.
(possibly via a FactoryAware interface)
Another
On 2/22/07, Joe Germuska [EMAIL PROTECTED] wrote:
This page is the place to start on using the Spring plugin with Struts 2:
http://struts.apache.org/2.x/docs/spring-plugin.html
In short, Spring can instantiate any beans you want, either as singletons
or as prototypes (that is, a new bean is
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Joe Germuska
Sent: Thursday, February 22, 2007 11:58 AM
To: Struts Users Mailing List; [EMAIL PROTECTED]
Subject: Re: [S2] Equivalent of Servlet init() method?
On 2/22/07, Wesley Wannemacher [EMAIL
On 2/22/07, Wesley Wannemacher [EMAIL PROTECTED] wrote:
I don't know much about Spring and shied away from servlet context
listeners
because I didn't want the external dependencies. I'm not suggesting that
my
way is the best way, but if you have a requirement to write unit tests for
all of
7 matches
Mail list logo