David,

Well the answer is simple yet complex.

First off what you want to do is of course not quite possible right now.


MessageResources are loaded from a property file based on locale, and
are initialized in the loadLocale method. 

Examination of that method shows that if the locale is already loaded
then don't try to reload it. 

So the simple answer is you need to create your own class extending
(probably) PropertyMessageResources and a factory class that
instantiates your class for use (factory extends either
MessageResourceFactory or PropertyMessageResourceFactory). You could
override MessageResources but I think propertyMessageResources is the
right superclass, and you override loadLocale and getMessage(String,
String). 

Al

-----Original Message-----
From: David Johnson [mailto:[EMAIL PROTECTED] 
Sent: Thursday, April 07, 2005 1:08 PM
To: Struts Users Mailing List
Subject: Error Messages from the Database - Simple method?

Hi all

I have a similar need to a topic entitled "Load Message Resources from
DB???" but only for ERROR messages, and quite honestly, I want the
simplest approach possible.

since my Error Messages and my other test fields currently share
"ApplicationResources.properties" I'm a little trapped though, and
that's fine because I want it **totally*** transparent from the JSP
tag

My current vision is this:

I will have a simple table as follows

appliction_errors
error_label - varchar(25)
error_text -  varchar(255)

I will build a service within a plug-in to retrieve all of the error
messages from the database and replace the proprtties bundle that
struts loads.

My questions are:

1. Where does stuts actually load up the message resources from the
file into memory

2. What is the name and type of the variable (to make it transparent
to the JSP tag

3. is it possible to just load up a new object and **replace** the one
that struts creatd with mine?

if not, what am I missing?

-- 
-Dave
[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