Struts2:具有多个参数的 getText 未填充

Struts2: getText with multiple parameters not populating

我将三个参数传递给 getText,但只有第一个参数被填充。

getText("error.invalidcode", new String[] {"name", "age", "xyz"});

在我的 ApplicationResources.properties

error.invalidcode={0} and {1} property has error with code {2}.

我得到以下结果: 名称和 {1} 属性 代码 {2} 有错误。

我错过了什么?

包含特殊字符的字段出现问题。

error.missingfield={0}'s and {1} property has error with code {2}.

不得不通过添加另一个单引号来转义:

error.invalidcode={0}''s and {1} property has error with code {2}.