Background
I am developing a Java Web Application using Maven. I have created ResourceBundles in this path and format: src/main/resources/i18n/LanguageBundle_xx_XX.properties.
Everything works perfectly and I have everything working on the front end (using JSTL).
Problem
The user can create KEY/VALUE pairs, from the front end, that are then stored in a MySQL database in the format: KEY | VALUE
I have a initializing servlet that does all the setting up before taking the user to the first jsp page.
In that initializing servlet I am getting all the KEY/VALUE pairs from the database, but now I want to add them to the LanguageBundle so that translations are ready when the first jsp page is presented.
I've tried so far:
- Returning all the key/value pairs from the DB
- Iterating the values returned
- If KEY doesn't exist in LanguageBundle_xx_XX
- Add the KEY/VALUE with property.put("KEY","VALUE")
Now, that does add the property, however if I try to access that specific property outside that scope (e.g., other servlets, jsp), it fails as it doesn't exist in the specific .properties file.
How do I solve this problem?