struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Duan Qiang" <qd...@ilog.com.sg>
Subject Use subclass or ResourceBundle in Struts
Date Fri, 11 Jul 2003 07:31:45 GMT
Hi,

I need to use a subclass of resourceBundle to allow dynamic loading of message changes and
other requirements, so the default implementation does not fit my needs.

Here is what I have done but it does not work.

1) define a class of test.MyResourceBundle extends ResourceBundle
2) define the class name to be my resoucebundel instead of a property file in web.xml

    <init-param>
      <param-name>application</param-name>
      <param-value>
        test.MyResourceBundle
      </param-value>
3) use <bean:message key="test" />, it can not find the message key "test". 

In a standalone program, it's possible to use the following codes,

    ResourceBundle bundle = ResoruceBundle.getBundle("test.MyResourceBundle");
    String testValue = bundle.getString("test");

I think Struts uses a simliar mechanism, however, my test did not work.

Any input is appreciated.

Regards,

Dq



Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message