Re: What's the right place for application configuration information?
Matt Raible <[email protected]> Thu, 5 Dec 2002 09:36:00 -0700
| Newsgroups | gmane.comp.web.mvc.devel |
|---|---|
| Message-ID | <A367C726-086F-11D7-9FE0-0003935AF4AE__14549.0019269802$1039106559@raibledesigns.com> |
--Apple-Mail-6-669418544 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=ISO-8859-1; format=flowed I think it depends on how much you will need to alter this information.=20 What I do in my applications is create an app-config.xml file that=20 lives in WEB-INF or the $user.home directory - then I use Castor to=20 turn marshal those values into a JavaBean called Configuration - which=20 I put in the ServletContext and call when I need it. Another approach=20 is to use context-parameters in your web.xml file. However, once you=20 get a bunch of these, you'll want to move to the XML->JavaBean approach. HTH, Matt On Thursday, December 5, 2002, at 08:08 AM, Tim Reilly wrote: > Hi there, > > I'm trying to find out what the right place for your own configuration=20 > information is.=A0 I'm talking about the kind of stuff you used to just=20 > put into a .properties file.=A0 I'm new to Struts, and I'm not sure if=20 > there's a better way to do it now. > > Does this kind of configuration information belong in: > > 1) A ServletConfig [seems wrong, since with Struts I don't have my own=20 > servlet]. > 2) Your own .properties file > 3) A separate MessageResource file from the one used for your messages? > or > 4) Some other place / method of access I don't yet know about. > > I can't seem to find an answer to this in the struts-mailing list=20 > archives or on the web. > > Thanks for your help, > > -Tim > --Apple-Mail-6-669418544 Content-Transfer-Encoding: quoted-printable Content-Type: text/enriched; charset=ISO-8859-1 I think it depends on how much you will need to alter this information. What I do in my applications is create an app-config.xml file that lives in WEB-INF or the $user.home directory - then I use Castor to turn marshal those values into a JavaBean called Configuration - which I put in the ServletContext and call when I need it. Another approach is to use context-parameters in your web.xml file. However, once you get a bunch of these, you'll want to move to the XML->JavaBean approach.=20 HTH, Matt On Thursday, December 5, 2002, at 08:08 AM, Tim Reilly wrote: <excerpt><fontfamily><param>Arial</param><smaller>Hi = there,</smaller></fontfamily> <fontfamily><param>Arial</param><smaller>I'm trying to find out what the right place for your own configuration information is.=A0 I'm talking about the kind of stuff you used to just put into a .properties file.=A0 I'm new to Struts, and I'm not sure if there's a better way to do it now.</smaller></fontfamily> <fontfamily><param>Arial</param><smaller>Does this kind of configuration information belong in:</smaller></fontfamily> <fontfamily><param>Arial</param><smaller>1) A ServletConfig [seems wrong, since with Struts I don't have my own servlet]. 2) Your own .properties file 3) A separate MessageResource file from the one used for your messages? or 4) Some other place / method of access I don't yet know = about.</smaller></fontfamily> <fontfamily><param>Arial</param><smaller>I can't seem to find an answer to this in the struts-mailing list archives or on the = web.</smaller></fontfamily> <fontfamily><param>Arial</param><smaller>Thanks for your = help,</smaller></fontfamily> <fontfamily><param>Arial</param><smaller>-Tim</smaller></fontfamily> </excerpt>= --Apple-Mail-6-669418544--