I had a guy ask me why his internationalized properties were not accessible
in his Struts app that was using both the REST and Convention plug-ins.  My
first action was to read the docs which did not suggest anything out of the
ordinary, so I through a core app together using this configuration and sure
enough the properties were not found!

He is using

    <constant name="struts.convention.action.suffix" value="Controller"/>

So I figured an Action called FooController would find
FooController.properties in the same folder as the FooController.class,
which as it turns out did *not* work.  I set a breakpoint at the top of
LocalizedTextUtil and the localist contains only the following two files
[org/apache/struts2/struts-messages,
com/opensymphony/xwork2/xwork-messages].  Shouldn't this collection include
my FooController.properties on a request http://.../foo?  Including a
message key from struts-messages works fine, however a key from
FooController.properties returns the key itself as it is not being located.

    public static String findDefaultText(String aTextName, Locale locale) {
        List<String> localList = DEFAULT_RESOURCE_BUNDLES;

        for (String bundleName : localList) {
            ResourceBundle bundle = findResourceBundle(bundleName, locale);
            if (bundle != null) {
                reloadBundles();
                try {
                    return bundle.getString(aTextName);
                } catch (MissingResourceException e) {
                    // ignore and try others
                }
            }
        }

        return null;
    }

Reply via email to