java - 如何重新加载 JSF 使用的 ResourceBundle?

标签 java jsf

我想在单击按钮时以编程方式重新加载 JSF 使用的 ResourceBundle。类路径中的 ResourceBundle(即 WEB-INF/classes)被外部应用程序修改,修改事件为我所知。

最佳答案

尝试

ResourceBundle.clearCache(Thread.currentThread().getContextClassLoader());

(你可以使用不带参数的相同方法)

来自javadoc

Resource bundle instances created by the getBundle factory methods are cached by default, and the factory methods return the same resource bundle instance multiple times if it has been cached. getBundle clients may clear the cache, manage the lifetime of cached resource bundle instances using time-to-live values, or specify not to cache resource bundle instances. Refer to the descriptions of the getBundle factory method, clearCache, ResourceBundle.Control.getTimeToLive, and ResourceBundle.Control.needsReload for details.

关于java - 如何重新加载 JSF 使用的 ResourceBundle?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2047891/

相关文章:

java - 找到链表中的最小值

javascript - JSF:一起使用 onclick + actionListener

javascript - JSF 1.2 文本到 Javascript 文本。如何转义反斜杠

javascript - 使用 JS 为隐藏文本输入赋值

java - 使用请求范围的 bean 函数作为 JSF 中临时呈现按钮的操作

Java 服务器具有许多客户端连接而不会出现瓶颈

java - Spring MVC : IP restriction for a single controller method

java - Gson 缺少对象 ArrayList 的类型参数

java - 如何使用扩展 AbstractTableModel 的类正确更新 Jtable?

css - 如何将样式应用于 PrimeFaces 数据表?