Skip to content

JSTL and Locale

illyfrancis edited this page Oct 10, 2013 · 1 revision

How to set JSTL locale

Quick answer

you need the 2nd:

3 ways to set JSTL locale: /as well as default application resource bundle, time zone, and data source/

Set by a JSTL action – this allows specification of scope by the scope attribute.

<fmt:setLocale value="en_US" scope="session"/>

Set Programmatically – allows specification of scope via the Config API.

import javax.servlet.jst.jstl.core.Config;
(...)
Config.set( session, Config.FMT_LOCALE, new java.util.Locale("en_US") )

Set by Context Initialization Parameters – specifies value used if setting not found in any of the standard scopes.

<context-param>
    <param-name>javax.servlet.jsp.jstl.fmt.locale</param-name>
    <param-value>en_US</param-value>
</context-param>

Clone this wiki locally