I don't believe you can do this for a couple of reasons:
1) Although the DTD has a className attribute for the message-resources
element, nothing is actually done with it and so you can't actually
configure Struts to use your own custom MessageResourcesConfig
implementation. Take a look at o.a.s.c.ConfigRuleSet - in order for a custom
MessageResourcesConfig it would have to do something with the className
attribute to instantiate your custom config - but it doesn't, it always
creates MessageResourcesConfig.
2) If the above issue was resovled, then the second problem from what I can
see is that the MessageResourcesConfig isn't actually passed to the factory.
ActionServlet initializes the MessagesResources by acessing the
MessageResourcesConfig properties directly. IMO the MessageResourcesConfig
should be available to the MessageResourcesFactory.
You could create a bugzilla ticket for this but a workaround would be to
initialize your property in your custom MessageResources through a Struts
PlugIn.
Niall
- Original Message -
From: Per Lovdinger [EMAIL PROTECTED]
To: user@struts.apache.org
Sent: Thursday, March 03, 2005 9:45 AM
Subject: Accessing properties in MessageResourcesConfig from
PropertyMessageResources
Info:
message-resources parameter=ApplicationResources
factory=MyOwnFactory
class=MyOwnConfig
set-property property=xProp value=xValue/
/message-resources
MyOwnFactory extends PropertyMessageResourcesFactory
MyOwnFactory instansiates MyOwnMessageResources
MyOwnMessageResources extends PropertyMessageResources
MyOwnConfig extends MessageResourcesConfig
MyOwnConfig has a property called xProp
Problem:
How can my class MyOwnMessageResources access property
in MyOwnConfig ?
Is there a static method somewhere in Struts api ?
thanks in advance
Per
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]