Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/spring-mvc/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Spring mvc 显示';对象';而不是SpringMVC的参数值+;使用MessageSource实现i18n_Spring Mvc_Internationalization - Fatal编程技术网

Spring mvc 显示';对象';而不是SpringMVC的参数值+;使用MessageSource实现i18n

Spring mvc 显示';对象';而不是SpringMVC的参数值+;使用MessageSource实现i18n,spring-mvc,internationalization,Spring Mvc,Internationalization,使用SpringMVC,将显示“对象”名称而不是参数值。下面是我的代码 msg("label.key.is.inactive", "Parameter"); label.key.is.inactive = key ''{0}'' is inactive. -- Present in properties file @Autowired private MessageSource messageSource; protected String msg(final String msgKey,

使用SpringMVC,将显示“对象”名称而不是参数值。下面是我的代码

msg("label.key.is.inactive", "Parameter");

label.key.is.inactive = key ''{0}'' is inactive. -- Present in properties file

@Autowired
private MessageSource messageSource;

protected String msg(final String msgKey,final Object... params){
  return messageSource.getMessage(msgKey, new Object[]{params}, Locale.US);
}
输出: 应为:键“参数”处于非活动状态。 Actual:key'[Ljava.lang.Object;@394a861'处于非活动状态

有人能告诉我应该做些什么来获得预期的输出吗。

试试这个:

return messageSource.getMessage(msgKey, params, Locale.US);