> -----Original Message-----
> From: Jim Barrows [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, December 29, 2004 8:15 AM
> To: Struts Users Mailing List
> Subject: RE: message resources in db
> 
> > -----Original Message-----
> > From: Nathan Coast [mailto:[EMAIL PROTECTED]
> > Sent: Wednesday, December 29, 2004 4:17 AM
> > To: Struts Users Mailing List
> > Subject: message resources in db
> > 
> > 
> > Hi,
> > 
> > Has anyone developed message resources that pulls messages 
> > from a db? I 
> > have followed a few links that discuss this but can't find any code:
> > 
> > http://wiki.apache.org/struts/StrutsMessageResourcesFromDatabase
> 
> This notion keeps popping up, and I keep wondering why.  On 
> the surface it seems okay, keep everything where it's easy to 
> maintain... but in reality, you really don't buy anything with it.
> If you do it so you can dynamically change the values, then 
> you slow down your page throughput quite painfully.  So, of 
> course you cache the data... which means it's not dynamic and 
> you either provide a way to flush the cache (which you could 
> do for a flat file as well, as Spring has apparently done).  
> Then you have the apparent fact that by doing so you are now 
> outside the Java provided i18n stuff, so you might be in a 
> position of trying to maintain this code to keep up with what 
> Java provides for you autmatically.
> So, you gain what?  it's in a database?
> I'm curios as to what you're reasoning is to put these into a 
> database, coz I'm looking for a good excuse to do it myself :)

Why?  Well reporting (crystal reports) is much easier if
all the strings for statuses and types are in the DB.
Also we allow the client to translate/modify strings
and I can see it would be easier to use the DB than
modify .properties files (although we went with the latter
for other reasons).

There are not really any of the problems you mentioned.
You just override loadLocale() to load from some other
source - could be a database, XML file, or whatever.
The rest of the class does all the caching just like
with a .properties file and the rest of your application
can't even tell the difference.  No slowdown because its cached.

If you want it dynamic you will have to add a way to detect
changes and clear the cache, but that is really a separate
issue from where your i18n data is stored.  The app I am
working on now has dynamic values with .properties files.
- Dan


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to