7.4 An Overview of the I18N Actions

   

The JSTL internationalization actions, which were listed at the beginning of this chapter and introduced in "Overview" on page 250, are listed in Table 7.5.

Table 7.5. JSTL Internationalization Actions

Action

Description

<fmt:setLocale>

Stores a locale in the FMT_LOCALE configuration setting. That configuration setting is used by <fmt:bundle> and <fmt:setBundle> actions to establish a localization context. The FMT_LOCALE configuration setting is also used by JSTL formatting actions. See "Formatting Actions" on page 308 for more information about formatting actions.

<fmt:setBundle>

Finds a resource bundle corresponding to the mandatory basename attribute and stores that resource bundle, along with the locale that was used to locate it, in a localization context stored in the FMT_LOCALIZATION_CONTEXT configuration setting. That resource bundle is only used by subsequent <fmt:message> actions, and the locale is only used by formatting actions.

<fmt:bundle>

Loads a resource bundle specified with the mandatory basename attribute and stores that resource bundle, along with the locale that was used to locate it, in a localization context. The resource bundle stored in the localization context is used by <fmt:message> actions in the body of the <fmt:bundle> action, and the locale stored in the localization context is used by formatting actions in the body of the <fmt:bundle> action.

<fmt:message>

Retrieves a localized message that corresponds to a key from a resource bundle. The <fmt:message> action sends that message to the current JspWriter or stores it in a scoped variable if the var attribute was specified.

<fmt:param>

Specifies a single parameter for a compound message. That parameter is used by an enclosing <fmt:message> action.

<fmt:requestEncoding>

Sets the character encoding for an HTTP request. This action is used to properly decode request parameters that were encoded in a charset other than ISO-8859-1 . [a]

[a] See "Request Encoding" on page 287 for more information about <fmt:requestEncoding>.

JSTL uses three configuration settings for internationalization. Those configuration settings are listed in Table 7.6.

Table 7.6. JSTL Internationalization Configuration Settings [a]

Setting

Description

 FMT_LOCALE (j.s.j.j.fmt.locale) 

Specifies a default locale for <fmt:message>. If you specify this configuration setting, you disable the preferred locales set for your browser. You can set this configuration setting with <fmt:setLocale>.

 FMT_FALLBACK_LOCALE (j.s.j.j.fmt.fallbacklocale) 

Specifies a fallback locale that <fmt:bundle> and <fmt:setBundle> use to find a resource bundle.

 FMT_LOCALIZATION_CONTEXT (j.s.j.j.fmt.localizationContext) 

This configuration setting specifies a localization context used by I18N and formatting actions. A localization context is a bean with two properties: a resource bundle and locale. [b]

[a] j.s.j.j = javax.servlet.jsp.jstl

[b] See "Localization Contexts" on page 263.

The JSTL actions and configuration settings listed in the preceding tables are discussed in more detail throughout the rest of this chapter.

   


Core JSTL[c] Mastering the JSP Standard Tag Library
Core JSTL[c] Mastering the JSP Standard Tag Library
ISBN: 131001531
EAN: N/A
Year: 2005
Pages: 124

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net