To: "Struts Users Mailing List" <user@struts.apache.org>
Sent: Thursday, April 07, 2005 2:53 PM
Subject: Re: [resources] was: Re: RESEND: RE: Load message resourcesfromDB???
James
I have a separate thread going on this, I apologize for that, but I'll summarize, and please excuse my ignorance.
Essentially, I understand your point , but if I may delve deeper,
I see that inheritance wise,
1. PropertyMessageResources extends MessageResources 2. PropertyMessageResourcesFactory extends MessageResourcesFactory
Logical.
So, I'll create
1. DatabaseMessageResources extends MessageResources 2. DatabaseMessageResourcesFactory extends MessageResourcesFactory
That's correct.
Questions 1. should I create them in the org.apache.struts.util. package? mucking with struts seems risky
No, do it seperately....com.company.util
2. how do I tell the application to use MY DatabaseMessageResourcesFactory and DatabaseMessageResources instead of PropertyMessageResourcesFactory and PropertyMessageResources
You configure Struts to use your factory by telling it in the Struts config: http://struts.apache.org/userGuide/configuration.html#resources_config
then... I'd just create my own Struts.jar with all my nice custom code in it? uggghhhorammmaaaa
No, make your own JAR. You don't want to have to deploy a custom Struts build with each project you use your new, and cool, Struts extension with.
also, that begs several questions...
1. where am I most logically making my DB connection? in my app now, it happens AFTER the message reources are loaded.
You make/manage the connection either: - as part the call to your factory class or - as part of the call to your getMessage(Locale locale, String key) method. or - (I suppose this is possible) - do it as a Struts Plugin
oh the pain...
Good luck with it!
-- James Mitchell Software Engineer / Open Source Evangelist Consulting / Mentoring / Freelance EdgeTech, Inc. 678.910.8017 AIM: jmitchtx Yahoo: jmitchtx MSN: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]