You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Per Lovdinger <pe...@yahoo.com> on 2005/03/03 10:45:54 UTC

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


	
		
__________________________________ 
Celebrate Yahoo!'s 10th Birthday! 
Yahoo! Netrospective: 100 Moments of the Web 
http://birthday.yahoo.com/netrospective/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Accessing properties in MessageResourcesConfig from PropertyMessageResources

Posted by Niall Pemberton <ni...@blueyonder.co.uk>.
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" <pe...@yahoo.com>
To: <us...@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: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org