Name

<fmt:setBundle>

Synopsis

The <fmt:setBundle> action sets the localization context configuration variable, which establishes the localization context for all other JSTL actions that rely on one and disables the locale lookup based on user preferences. Alternatively, the localization context may be saved as a scoped variable and provided as explicit input to other actions.

The localization context contains a locale and the best match for the specified resource bundle. The locale for the localization context is either the locale defined by the locale configuration setting or the best match for the user preferences specified by the Accept-Language HTTP request header.

Syntax

<fmt:setBundle basename="resourceBundleBasename" 
  [var="var"] [scope="page|request|session|application"] />

Attributes

Attributename

Java type

Dynamic valueaccepted

Description

basename
String

Yes

The basename for a resource bundle, see java.util.ResourceBundle for details.

var
String

No

The variable name. If omitted, the actions sets the localization context configuration variable. The type is javax.servlet.jsp.jstl.fmt.LocalizationContext.

scope
String

No

The scope for the variable or the configuration variable.

Example

<fmt:setBundle basename="labels" scope="session" />

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.