Name

<fmt:setLocale>

Synopsis

The <fmt:setLocale> action sets the locale configuration variable, establishing the locale for all other JSTL actions that rely on a locale, disabling the locale lookup based on user preferences.

Syntax

<fmt:setLocale value="locale" [variant="variant"]
  [scope="page|request|session|application"] />

Attributes

Attributename

Java type

Dynamic value accepted

Description

value

String or java.util.Locale

Yes

The locale. If set as a String, it must be an ISO-639 language code, optionally followed by an ISO-3166 country code and separated by a hyphen or an underscore character.

variant

String

Yes

A locale variant, see java.util.Locale for details.

scope

String

No

The configuration variable scope.

Example

<fmt:setLocale value="en-US" />

Get JavaServer Pages, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.