I'm using Sprinng 3.0.
How do I find the current locale set by a LocaleResolver within an annotation-based controller?
Thanks.
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:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With