title: How to set JSTL locale from Java code?
body: <p>I want to set the JSTL locale which is used by <code>&lt;fmt:formatNumber&gt;</code> and friends. I know this is possible with <code>&lt;fmt:setLocale&gt;</code>, 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.</p>
  
  <p>I thought setting the session attribute <code>javax.servlet.jsp.jstl.fmt.locale</code> to my desired <code>Locale</code> instance would do the trick, but it is ignored: The JSTL tags keep using the browser locale.</p>
  
  <p>I verified there are no page context or request attributes of the same name.</p>
  
  <p>So what am I doing wrong? Or do I really need to do it from a JSP?</p>
  
  <p>Reading the JSTL code, I found references to a <code>LocalizationContext</code> 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.</p>