I want to set the JSTL locale which is used by <fmt:formatNumber>
and friends. I know this is possible with <fmt:setLocale>
, but I need to do it dynamically (depending on user data retrieved from my DB) and would prefer Java code - a filter class, to be precise.
I thought setting the session attribute javax.servlet.jsp.jstl.fmt.locale
to my desired Locale
instance would do the trick, but it is ignored: The JSTL tags keep using the browser locale.
I verified there are no page context or request attributes of the same name.
So what am I doing wrong? Or do I really need to do it from a JSP?
Reading the JSTL code, I found references to a LocalizationContext
and think I need to set one. I couldn't quite figure out exactly how it fits into the picture or how to set one, though.