Localization does not work while code behind pulgin deal with url like 
/xxx/SomeAction-method.action
----------------------------------------------------------------------------------------------------

                 Key: WW-2812
                 URL: https://issues.apache.org/struts/browse/WW-2812
             Project: Struts 2
          Issue Type: Bug
          Components: Plugin - CodeBehind
    Affects Versions: 2.1.2, 2.0.11
            Reporter: Aray Chou
            Priority: Critical


using code behind plugin, /xxx/SomeAction-method.action will fail to deal with 
resource bundle. It won't follow the instruction in 
http://struts.apache.org/2.0.11.2/docs/localization.html.

It just don't use resouce files such as SomeAction.properties and 
package.properties. I read the source of struts2, and found that the probelm is 
in method 
org.apache.struts2.codebehind.CodebehindUnknownHandler.buildActionConfig(String,
 String, String, ResultTypeConfig)

 protected ActionConfig buildActionConfig(String path, String namespace, String 
actionName, ResultTypeConfig resultTypeConfig) {
        final PackageConfig pkg = 
configuration.getPackageConfig(defaultPackageName);
        return new ActionConfig.Builder(defaultPackageName, "execute", 
ActionSupport.class.getName())  // << PROBLEM HERE
                
.addInterceptors(InterceptorBuilder.constructInterceptorReference(new 
InterceptorLocator() {
                    public Object getInterceptorConfig(String name) {
                        return pkg.getAllInterceptorConfigs().get(name); // 
recurse package hiearchy
                    }
                }, pkg.getFullDefaultInterceptorRef(),
                Collections.EMPTY_MAP, null, objectFactory))
                .addResultConfig(new ResultConfig.Builder(Action.SUCCESS, 
resultTypeConfig.getClassName())
                        .addParams(resultTypeConfig.getParams())
                        .addParam(resultTypeConfig.getDefaultResultParam(), 
path)
                        .build())
                .build();
    }

It use ActionSupport.class.getName() as the action class of 
/xxx/SomeAction-method.action, NOT SomeAction. when deal with localization. it 
will search com.opensymphony.xwork2.ActionSupport_zh_CN.properties(and its 
super interface)  but foo.bar.SomeAction_zh_CN.properties and 
foo.bar.package_zh_CN.properties

If I fail to explain the problem clearly, please let me know, I will be very 
glad to give more info.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to