Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Struts Users »

Using ResourceBundle's subclass in Struts

Duan Qiang

2003-07-14

Replies:

Hi,

I posted a question but seems nobody replied. Anyone tried to define a subclass of ResourceBundle and use it in Struts?

For a standalone program, it's straightforward to use sel-defined resourcebundle classes, for example,

public class MyResourceBundle extends ResourceBundle
{
  public Object handleGetObject()
  ...
  public Enumeration getKeys()
}

//use the subclass
ResourceBundle bundle = ResourceBundle.getBundle("MyResourceBundle");

However, when I specify the resource name as "MyResourceBundle", Struts can not find the message bundle although my class MyResourceBundle is on classpath.

It's possible to replace <bean:message> tag using my own methods, however, the action controller I uses is an instance of DispatchAction, which will match a method name with the message bundle key, for example, "button.next" matches to the function "doNext" and so on.

So I can could totally avoid using struts message functionaliity, or how I can use my own ResourceBundle?

THx,

Regards,

dq
©2008 junlu.com - Jax Systems, LLC, U.S.A.