[
https://issues.apache.org/struts/browse/WW-2812?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Aray Chou updated WW-2812:
--------------------------
Priority: Trivial (was: Critical)
Description:
using code behind plugin, /xxx/foo/bar.action will use foo/bar.jsp to render
it. while deal with localization, it won't use foo/bar.properties and
foo/package.properties. It seems that, there is no proper resource file could
be used by foo/bar.jsp.
I think there sould be something to overcome this.
was:
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.
Issue Type: New Feature (was: Bug)
> 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: New Feature
> Components: Plugin - CodeBehind
> Affects Versions: 2.0.11, 2.1.2
> Reporter: Aray Chou
> Priority: Trivial
>
> using code behind plugin, /xxx/foo/bar.action will use foo/bar.jsp to render
> it. while deal with localization, it won't use foo/bar.properties and
> foo/package.properties. It seems that, there is no proper resource file could
> be used by foo/bar.jsp.
> I think there sould be something to overcome this.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.