Return-Path: Delivered-To: apmail-struts-user-archive@www.apache.org Received: (qmail 18318 invoked from network); 28 Jan 2009 02:32:48 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 28 Jan 2009 02:32:48 -0000 Received: (qmail 32695 invoked by uid 500); 28 Jan 2009 02:32:39 -0000 Delivered-To: apmail-struts-user-archive@struts.apache.org Received: (qmail 32672 invoked by uid 500); 28 Jan 2009 02:32:39 -0000 Mailing-List: contact user-help@struts.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Struts Users Mailing List" Reply-To: "Struts Users Mailing List" Delivered-To: mailing list user@struts.apache.org Received: (qmail 32661 invoked by uid 99); 28 Jan 2009 02:32:39 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 27 Jan 2009 18:32:38 -0800 X-ASF-Spam-Status: No, hits=1.2 required=10.0 tests=SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [209.85.132.244] (HELO an-out-0708.google.com) (209.85.132.244) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 28 Jan 2009 02:32:30 +0000 Received: by an-out-0708.google.com with SMTP id d14so1198548and.17 for ; Tue, 27 Jan 2009 18:32:07 -0800 (PST) Received: by 10.100.178.9 with SMTP id a9mr146318anf.59.1233109927394; Tue, 27 Jan 2009 18:32:07 -0800 (PST) Received: from wesw-laptop.localnet (cpe-98-31-31-91.woh.res.rr.com [98.31.31.91]) by mx.google.com with ESMTPS id d29sm13609745and.14.2009.01.27.18.32.06 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 27 Jan 2009 18:32:06 -0800 (PST) From: Wes Wannemacher Reply-To: wesw@wantii.com Organization: WanTii, Inc. To: "Struts Users Mailing List" Subject: Re: Best global parameter aproach for struts2 Date: Tue, 27 Jan 2009 21:31:59 -0500 User-Agent: KMail/1.11.0 (Linux/2.6.27-11-generic; KDE/4.2.0; x86_64; ; ) References: <21698744.post@talk.nabble.com> In-Reply-To: <21698744.post@talk.nabble.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200901272131.59510.wesw@wantii.com> X-Virus-Checked: Checked by ClamAV on apache.org On Tuesday 27 January 2009 21:20:17 Ignacio de C=F3rdoba wrote: > Hi there, > after starting some serious migration from struts to struts2 I am wonderi= ng > is there is any "best practices" for global application parameters. > I used to store this parameters in web.xml, but as struts2 finds important > not to be tied to the "http" thing (I read it very often in docs... about > unit testing, etc.) I find myself with problems every time I want to get a > web.xml init parameter. > In actions it is not that difficult, but it is in interceptors, as there = is > no way to get the ServletContext as they have no init method getting it as > a parameter. (I am now lazy loading that parameter at first Action > invocation to the interceptor) > I wonder if there is another aproach to set init parameters and forget > about web.xml... I need some init parameters easily readable from both > actions and interceptors... struts.xml, struts.properties, ... > > Thanks for any ideas, > Ignacio It might seem a bit extreme for simple values, but I use Spring. If configu= red=20 correctly, it will be mostly non-intrusive, then getting values for can be = as=20 simple as adding a setter to your action/interceptor/result. Then, in the=20 long-run, you also get the benefit of having Spring's libraries (for when y= ou=20 decide to integrate JPA, AOP or whatever is cool that week). =2DWes =2D-=20 Wes Wannemacher Author - Struts 2 In Practice=20 Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more http://www.manning.com/wannemacher --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@struts.apache.org For additional commands, e-mail: user-help@struts.apache.org