欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

如何在springmvc中获取国际化信息

程序员文章站 2022-03-03 12:37:18
...
public class SpringContext implements ApplicationContextAware {



public static String getMessage(String code, HttpServletRequest request) {
Locale locale = RequestContextUtils.getLocaleResolver(request).resolveLocale(request);
return applicationContext.getMessage(code, null, locale);
}

public static String getMessage(String code, String defaultMsg, HttpServletRequest request) {
Locale locale = RequestContextUtils.getLocaleResolver(request).resolveLocale(request);
return applicationContext.getMessage(code, null, defaultMsg, locale);
}
相关标签: springmvc