struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Fogleson, Allen" <>
Subject RE: Load message resources from DB???
Date Wed, 30 Mar 2005 04:04:20 GMT
Actually you have to extend MessageResources, and

I have a quick hack I did up tonight that works for a minimal case. (it
does not do the substitution and such. But if you just have a key=value
and value does not contain {x} in it then it will work. (Actually it
will work but print {x} :)

If anyone wants the source feel free to email me and I will send it
along. I'll leave the substitution and implementation of other methods
to whoever needs it. Seems to me like this is a terrible hit to
performance. I did not implement a cache though so it is a TERRIBLE hit
to performance. Mostly wanted to see how hard it would be to grab them
from the DB. 


-----Original Message-----
From: Corey Probst [] 
Sent: Tuesday, March 29, 2005 9:12 PM
To: Struts Users Mailing List
Subject: Re: Load message resources from DB???

> Even if I could just get some general directions on what method to
pull the data in, and what method to put the data into what type of
> Just something would be good.

I think I remember reading a post about this before.
Start by looking at the PropertyMessageResources source code,
specifically, the loadLocale and getMessage methods.  This is where
the properties are read from the file (for that implementation).  You
can probably extend that class and load the messages from a database
by overriding one of those methods (loadLocale).  You would also need
a method to clear the cache of messages when they are updated. (Be
careful in a clustered environment)

On second thought you can probably just extend MessageResources and
implement the getMessage method.

Hope that helps... even if it's just a little bit.


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

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

View raw message