struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Hill" <>
Subject RE: application configuration
Date Thu, 08 Jul 2004 12:01:01 GMT
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.
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 []
Sent: Thursday, 8 July 2004 19:56
To: Struts Users Mailing List;
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

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 create a servlet and configure it in web.xml with

Is this ok...or is there any better approach to do the same thing..?


-----Original Message-----
From: Andrew Hill []
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

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

-----Original Message-----
From: news []On Behalf Of j h
Sent: Thursday, 8 July 2004 19:23
Subject: application configuration

If there are specific properties that need to be configured on
where should these be put? you could put these in the
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

To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message