如何在Web应用程序中重新加载资源包? [英] How to reload resource bundle in web application?

查看:121
本文介绍了如何在Web应用程序中重新加载资源包?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有资源包作为Java类从数据库中读取值。当我更新数据库我需要重新加载包,但我不知道如何。有人帮忙吗?

I have resource bundle as Java class that read values from database. When i update db i need to reload bundle, but i don't know how. Anybody helps ?

package model.helpers;
public class Messages_en extends ListResourceBundle {
      protected Object[][] getContents() {
            // from DB
            // ...
      }
}

在视图中我使用bundle如下:

In view i use bundle as below:

<f:loadBundle basename="model.helpers.Messages" var="m" />


推荐答案

ResourceBundle.clearCache();     

OR

Messages_en .clearCache();

调用此方法将重新加载资源,它将刷新包

Calling this method will reload the resources, it will refresh the bundle

  • Reference

这篇关于如何在Web应用程序中重新加载资源包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆