On Apr 25, 2005, at 4:25 PM, Bruno Haas wrote:

Hi All,

From what I gather in the documentation, it is possible to inject a localized string into a component by using the <message-binding> tag. This is nice but let's say I have a component that takes an array of strings as an input parameter. Would there be a way to somehow access the pages .properties from the contained component ?

In other words, I don't know beforehand the strings my component will need to render or even how many there are and I would need the localized strings to be obtained from outside the component.

Have some of you faced the same problem ? How do you usually solve this ?

All components (and pages are components) have access to the message resources. <message-binding> is a convenience, but you can get directly at message resources through the API:


http://jakarta.apache.org/tapestry/doc/api/org/apache/tapestry/ IComponent.html#getMessages()

You could pass in an array of message keys to your component, and access the parent page's messages using getPage().getMessages(), or you could resolve the messages from the page and pass the resolves strings into the component using the same mechanism.

        Erik


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to