0

I would like to have a dynamic resource bundle in my application. I will show a form to the user where he can edit the value of Resource Bundle. I can’t restart my application for this changes take effect. I found a solution that solves part of my problem. Using “commons-configuration” from Apache or/and this http://www.coderanch.com/t/292347/JSP/java/we-reload-property-file , i could change my “.properties” file and get the results using “ResourceBundle.getBundle” . The problem is when I try to access the property in my XHTML file like this:

<h:outputLabel value="#{msg[user.name]}" />

The value of this key is out of date.
Is there a solution for this?

Just for info, I am using spring, so I have this in my faces-config:

<el-resolver>org.springframework.web.jsf.el.SpringBeanFacesELResolver</el-resolver>

But I don’t think this is the problem. Anyway, another solution would be to use a session bean and get the property values accessing it. What do you think about it? Would be better store this values in my database and forget about the properties file?

bzlm
  • 9,626
  • 6
  • 65
  • 92
Leandro
  • 101
  • 1
  • 3
  • 7
  • Related: http://stackoverflow.com/questions/4325164/how-to-reload-resource-bundle-in-web-application Please note the answer of arjan. – BalusC Feb 08 '11 at 23:18
  • Thank you brother! I will try arjan code too. I have already gotten the expected results. I had a minor problem when i try to change configurations like "config.dataTable.rowsPerPage", but i think this should be a primefaces problem. – Leandro Feb 10 '11 at 14:40

1 Answers1

0

\o/

I have tested to move my resource bundle definition from my faces-config to my page using tag f:loadBundle and it worked!

Leandro
  • 101
  • 1
  • 3
  • 7