JSF 2.0 Validation messages from database
-
26-09-2019 - |
Question
I am using a database to hold all text values of my web pages so i can switch between different languages. I added JSF 2.0 to my project but failed when i tried to get the validation messages from my database too. Is there a way to write my own validation-messagesource which retrieves the messages from a database?
I'd really appreciate any help!
Thank you all in advance,
best regards, Robert
Solution
You could extend java.util.ResourceBundle and put something like this in faces-config.xml:
<application>
<locale-config>
<default-locale>en</default-locale>
</locale-config>
<message-bundle>package.MyResourceBundle</message-bundle>
<resource-bundle>
<base-name>package.MyResourceBundle</base-name>
<var>msg</var>
</resource-bundle>
</application>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow