There are two other options that I've used in the past... One is
Spring. You could create a custom bean or set of beans and initialize
them with Spring and use the spring plug-in to help get at those beans
any time you need them.

Spring is a big framework though and will add some complexity. The
other option, if you are hoping to keep from depending on the Servlet
API is a static initializer block. The problem with static blocks
though is that they can get out of control when you start adding them
to obscure classes. If you only have a small amount of lifting to do,
I would use a static block. The advantage is that it adds no external
dependencies which will make unit testing easy, but the disadvantage
is that it can become unwieldy.

If you are working on a large app, go with Spring, you may end up
using some of it's other features. For a small app with minimal
lifting, go with the static block. Of course, depending on the Servlet
API isn't all bad, so don't count it out unless you really need to.

-W

On 11/9/07, tom` frost <[EMAIL PROTECTED]> wrote:
> I would still need to use the Servlet API to retrieve those values,
> correct?  I'm trying to find a way to pass in values directly to Struts, I
> guess.
>
> On 11/9/00, Martin Gainty <[EMAIL PROTECTED]> wrote:
> >
> > Hi Tom-
> >
> > how about implementing the default initialisation parameters by placing
> > the
> > init-param in web.xml?
> > e.g.
> >         <init-param>
> >             <param-name>debug</param-name>
> >             <param-value>true</param-value>
> >         </init-param>
> >
> > M--
> > ----- Original Message -----
> > From: "tom` frost" <[EMAIL PROTECTED]>
> > To: <user@struts.apache.org>
> > Sent: Friday, November 09, 2007 12:41 PM
> > Subject: S2 best location of application init params
> >
> >
> > > I'm looking for the best place to put application init stuff.  I'm
> > thinking
> > > of something like the home directory of the file system to which the
> > > application will write to.  What's the best way of apssing such
> > information
> > > in.  In the past I have used servlet api init params, but with all the
> > > effort made in S2 to separate your code from Servlet api, surely there's
> > a
> > > better way.
> > >
> > > Thanks,
> > > Tom
> > >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>


-- 
Wesley Wannemacher
President, Head Engineer/Consultant
WanTii, Inc.
http://www.wantii.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to