views:

109

answers:

1

Is there any mechanism to load the properties file from the file system in struts2? I am coming up with a hot deployment mechanism. If I update the war file, it would be redeployed. I am able to reload properties file on the fly using

LocalizedTextUtil.clearDefaultResourceBundles();
LocalizedTextUtil.addDefaultResourceBundle("struts/resources");

but it would only look in the struts2 default location.

Any solution, hack, workaround is heartily welcomed.

A: 

You can achieve this by: 1. Tell struts to use a certain property bundle. 2. Add it to the classpath

Example:

In Struts.properties:

....
struts.custom.i18n.resources=globalMessages
....

Create globalMessages.properties (and any locale specific bundles, such as globalMessages_ru_RU.properties ), place the bundle(s) in a folder called /app_conf/i18n and finally place the directory /app_conf/i18n in the class path.

asa