Reading from the 'Jakarta Struts Cookbook' by Bill Siggelkow, he discusses this problem. "You want to store all labels,messages, and other static text in a database rather than a properties file, while still being able to access the values using the bean:message tag"

If this is what you're looking for, go to: http://prdownloads.sourceforge.net/struts/OJBMessageResources.war.zip

The only date I can find on this is 2003 however. More on OJB is here :http://db.apache.org/ojb/

- Nix.

Günther Wieser wrote:

resend because i didn't receive it on the list. sorry if this comes to you
for the second time.

hi,

as it isn't possible to send zip files to the list, i need to copy and paste
the most important things out of our implementation:

the factory is simple:
public class DBPropertyMessageResourcesFactory extends
MessageResourcesFactory {

   /* (non-Javadoc)
    * @see
org.apache.struts.util.MessageResourcesFactory#createResources(java.lang.Str
ing)
    */
   public MessageResources createResources(String config) {
       return new DBPropertyMessageResources(this, config,
this.returnNull);
   }
}

also, the DBMessageResources class is quite simple, here's the most
important method:

public String getMessage(Locale locale, String key) {
String result = DBPropertyMessageService.getMessage(locale, key,
returnNull);
// we need to flush the cache of the super class MessageResource as
we want to have real // dynamic data here (no caches
// except the one in DBPropertyMessageService)
formats.clear();
return result; }


so the REAL thing is happening in DBPropertyMessageService, and this class
just loads everything at startup (static constructor) into a hashmap. we
have implemented the service class in such way that it's the one and only
point where changes to a property have to go. this allows us to change
values during runtime, and even add new key value pairs during runtime
without reloading from the db.
it's also easy to implement a feature that reloads the db entries ater a
given period of time.

kr,
guenther

--
Günther Wieser

creative-it
Guglgasse 6/1/11/1
A-1110 Wien
Austria
http://www.creative-it.com


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 30, 2005 2:52 AM
To: user@struts.apache.org; [EMAIL PROTECTED]
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 container.
Just something would be good.

----------
Thanks...
Mick Knutson

Systems Developer
Business Direct Services, Wells Fargo Bank
333 Market Street, SF, CA  94103
(415) 371-2553
[EMAIL PROTECTED]
MAC A0103-223

"This message may contain confidential and/or privileged information. If you
are not the addressee or authorized to receive this for the addressee, you
must not use, copy, disclose, or take any action based on this message or
any information herein. If you have received this message in error, please
advise the sender immediately by reply e-mail and delete this message. Thank
you for your cooperation."
----------



-----Original Message-----
From: Jason Long [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 29, 2005 4:41 PM
To: 'Struts Users Mailing List'
Subject: RE: Load message resources from DB???


I am still waiting for an example of this as well. I would very much like to add this feature, but is not critical and I have other things to work on. If you find an example please let me know.

Thank you for your time,

Jason Long
CEO and Chief Software Engineer
BS Physics, MS Chemical Engineering
http://www.supernovasoftware.com


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 29, 2005 6:38 PM
To: user@struts.apache.org
Subject: RE: Load message resources from DB???

Does anyone ahve any examples of extending the PropertyMessageResources  and
PropertyMessageResources Factory?


-----Original Message----- From: Daniel Lipofsky [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 15, 2005 1:35 PM To: Struts Users Mailing List Cc: [EMAIL PROTECTED] Subject: RE: Load message resources from DB???


Yes, just extend the PropertyMessageResources and overide the loadLocale() method. You should extend the factory too and specify the new factory in struts-config.xml. Add a method to clear the cache in the PropertyMessageResources and clear it when the user changes something. - Dan



-----Original Message-----
From: Jason Long [mailto:[EMAIL PROTECTED]
Sent: Monday, March 14, 2005 11:21 PM
To: 'Struts Users Mailing List'
Subject: Load message resources from DB???

Is it possible to load the message resources from a database instead of a file? If so can this be done without reloading the entire application? I would like to let users manage these.

Thank you for your time,

Jason Long
CEO and Chief Software Engineer
BS Physics, MS Chemical Engineering
http://www.supernovasoftware.com




---------------------------------------------------------------------
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]




--------------------------------------------------------------------- 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]



Reply via email to