We (the company I am working in) are trying to separate our framework from our applications. I was given the task to work out a solution how to separate the .properties file of the application and the ones for our framework.
Currently we are storing all of our text in one .properties file. I've already worked out a basic solution (which I unfortunately cannot show here, private business stuff you know) but as we are using JSP pages and ActionMessages to display errors and stuff and our simple intern method quickly blows up the code of displaying a simple message, I'd like to work out a solution that requires almost no chances to our current code.
What I've got so far:
In struts-config.xml, you declare the following line to include your .properties file.
But you cannot simply put two of these lines into the config (like the following) because it would overwrite the previous:
After a little more research, I've found out that you can put a key in this tags so they can be distinguished.
The problem here is: You have to know, where the message key is located and that is something that we should not have to care about in our code.
And as far as I have seen, there is no fast (meaning one-liner) way of getting the value of a message key in Java code. So something like the following does not work:
As I've said, we have a method somewhere to put in the correct values and I also know that you can add a normal string to an ActionMessage by using the boolean parameter in the Constructor.
But I (or we) want to avoid this.
I should add that I am new to Java / JSP development. I'm working with it for about 2 months know and before I did C# / .NET development so there is a lot of stuff I don't know about.
If someone knows a solution, thank you in advance.