If you want to manage properties using Struts mechanisms, you can set up a message-resources reference to your property file (say, "ApplicationResources.properties") in the struts-config.xml file right after the action-mappings block:
<message-resources parameter="com.yourdomain.application.ApplicationResources" /> then call the protected getResources method within any class extending org.apache.struts.action.Action: MessageResources resources = getResources(request); or outside an Action class (such as in the inherited ActionForm methods) do: MessageResources resources = (MessageResources) request.getAttribute(Action.MESSAGES_KEY) The benefit here is simplicity and forward-compatibility you get from using the built-in property mechanisms Struts gives you for free. The downside is the (current) awkwardness of maintaining duplicate properties if you are using the sub-application feature, which a lot of people don't. -JT -----Original Message----- From: micael [mailto:[EMAIL PROTECTED]] Sent: Sunday, September 22, 2002 10:59 AM To: Struts Users Mailing List Subject: Re: How to manage application properties? You can create classes and objects in struts just like you can with any other application. Attached is a file with a few classes I use to teach students about the Properties class in java.util. Change the value in Folder (line 138, if you are not using Windows). PropertiesManager creates properties files from which the locations of other properties files is managed. It also uses default properties, etc. Micael At 12:07 AM 9/22/2002 -0700, you wrote: >Hello, > >This is a very "newbie" question I'm sure, so this might not be the >appropriate forum. Maybe it belongs in the Tomcat forum? Not sure. > >Pretty basic objective.... I just want to be able to put application >settings (things like path names, integer values, etc) in a *.properties >file and access those properties from within my tomcat/struts(1.1) >application. I see quite a bit of talk about >ApplicationResources.properties, but it seems like people are only using >that to store and retrieve messages. I'd rather not mix my messages with >my settings. How do you do it? I'm aware of the java.util.properties >class.... but I don't really know how to efficiently use it within the >application servlet context (I don't want to reload it with every >request)..... and I wouldn't know when to load it into application >scope..... anyway, you see that I don't have a clue. I can think of >plenty of ways to do it, but I would like know the most common/accepted >method(s). So any tips would be much appreciated :) > >Thanks! > > > > > >--------------------------------- >Do you Yahoo!? >New DSL Internet Access from SBC & Yahoo!