Locating a locale from a controller in Spring MVC

I am using Sprinng 3.0.

How to find the current locale set by LocaleResolver in an annotation based controller?

Thanks.

+7
spring spring-mvc
source share
1 answer

You can declare an argument of type Locale in your controller method:

 @RequestMapping public ModelAndView foo(..., Locale locale) { ... } 

See also:

+21
source share

All Articles