This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Say I'm in a struts action: to get the list of keys from ApplicationResources.properties, I do the following:
Now I understand that if I call messageResources.get(key) I will get back the requested property from ApplicationResources.properties.
Now suppose that a little later in the action I want to pass the messageResources object I just retrieved to a Manager/Logic class, so it can retrieve a key, but without making the Manager/Logic dependent on the Struts Framework.
Would I simply retrieve the value from the messageResources and pass it into the Manager/Logic method? (this seems a little awkward since so many values are being passed this way)
Actually, the method on MessageResources that gets the message is getMessage(key) or getMessage(locale, key);
I don't see any other alternatives than the ones you've already presented. Either you make your manager object dependent on Struts and pass it the MessageResources object, or you have your action class get the message first and pass it in as a string to your manager class.