Finding Locale from Controller in Spring MVC
LocaleContextHolder
can be used, especially to obtain the Locale
outside of a controller method.
Locale locale = LocaleContextHolder.getLocale();
You can declare an argument of type Locale
in your controller method:
@RequestMapping
public ModelAndView foo(..., Locale locale) { ... }
See also:
- 15.3.2.3 Supported handler method arguments and return types