As an added bonus. Just after 1.1 was released Joe offered a cool plugin called DigestingPlugin that takes most (if not all) of the hard work out of getting your xml -> bean done. The only thing I've used that comes close is JAXB.
Check it out: http://cvs.apache.org/viewcvs.cgi/jakarta-struts/src/share/org/apache/struts /plugins/DigestingPlugIn.java -- James Mitchell Software Engineer / Open Source Evangelist EdgeTech, Inc. 678.910.8017 AIM: jmitchtx ----- Original Message ----- From: "Andrew Hill" <[EMAIL PROTECTED]> To: "Struts" <[EMAIL PROTECTED]> Sent: Thursday, July 08, 2004 8:01 AM Subject: RE: application configuration > Thats one approach. The other is to use a struts plugin. > I guess its a matter of taste. My personal preference is for plugins but > either way also can. > > Just implement the org.apache.struts.PlugIn interface and declare the plugin > in your struts-config.xml file. The ActionServlet will call the plugin when > your application starts. > > To deal with your config, properties files are nice and simple so if they > suit your needs go ahead and use them. > > If you want to do anything complex (like the nested objects one finds in > struts config) then XML becomes easier to use than properties, and Digester > makes it easy to read XML into objects based on rules you define. > [http://jakarta.apache.org/commons/digester/] > I dont have time to give an example of using Digester right now, but its > documentation gives some and its pretty straightforward. (Check out the > package summary in the javadocs) > > > -----Original Message----- > From: Viral_Thakkar [mailto:[EMAIL PROTECTED] > Sent: Thursday, 8 July 2004 19:56 > To: Struts Users Mailing List; [EMAIL PROTECTED] > Cc: Nilesh Suresh Rajurkar > Subject: RE: application configuration > > > I have a java file which read few properties file and put the key and > values read from these properties into HashMap object of singleton > class.. > > I am doing this to read all Fixed Values which I need to display in my > jsp pages. > > Now I want this class to run as soon as server starts... how to achieve > this ..?? > > One approach ...to create a servlet and configure it in web.xml with > <load-on-startup>1</load-on-startup> > > Is this ok...or is there any better approach to do the same thing..? > > Regards, > Viral > > > > -----Original Message----- > From: Andrew Hill [mailto:[EMAIL PROTECTED] > Sent: Thursday, July 08, 2004 4:56 PM > To: Struts Users Mailing List > Subject: RE: application configuration > > I tend to put such things in XML files rather than properties files > nowadays. > > When the app starts up I have a plugin read the files and create > configuration objects (using Digester), and put these objects into the > servlet context (application scope) where my code can get at them > easily. > > > -----Original Message----- > From: news [mailto:[EMAIL PROTECTED] Behalf Of j h > Sent: Thursday, 8 July 2004 19:23 > To: [EMAIL PROTECTED] > Subject: application configuration > > > If there are specific properties that need to be configured on > deployment, > where should these be put? you could put these in the > application.properties > file and read these in from an Action class every time they are needed: > MessageResources mr = getResources(request); > String config = mr.getMessage("configuration.detail"); > > This seems inefficient. Is there a way to read these into some global > variables? > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]