Java Server Pages 2nd Edition phần 9 ppsx

2 234 0
Java Server Pages 2nd Edition phần 9 ppsx

Đang tải... (xem toàn văn)

Thông tin tài liệu

Appendix B. JSTL Actions and API Reference 487 For a number type, the format specification can be currency, percent, integer, or the type of customized pattern described for <fmt:formatNumber>. <fmt:parseDate> The <fmt:parseDate> action parses a date and time value formatted according to locale- specific rules. A custom pattern can be specified, or locale-dependent default patterns for one or both of the date portion and the time portion can be selected. The locale used is the one explicitly specified or is taken from the locale configuration setting or the locale from the localization context setting. If none of these are set, the locale is determined as the best match for the user preferences (Accept-Language request header). Syntax 1: Without a body <fmt:parseDate value="dateAndTime" [pattern=" pattern" | [type="time|date|both"] [dateStyle="default|short|medium|long|full"] [timeStyle="default|short|medium|long|full"]] [timeZone=" timeZone"] [parseLocale=" locale"] [var=" var" [scope="page|request|session|application"]] /> Syntax 2: With a body <fmt:parseDate [pattern=" pattern" | [type="time|date|both"] [dateStyle="default|short|medium|long|full"] [timeStyle="default|short|medium|long|full"]] [timeZone=" timeZone"] [parseLocale=" locale"] [var=" var" [scope="page|request|session|application"]]> dateAndTime </fmt:parseDate> Attributes Attributename Java type Dynamic valueaccepted Description value String Yes The date and time to parse pattern String Yes A custom pattern in the form accepted by java.text.SimpleDateFormat; see fmt:formatDate. type String Yes Which portions the value contains. Appendix B. JSTL Actions and API Reference 488 dateStyle String Yes One of the predefined locale- dependent date patterns. timeStyle String Yes One of the predefined locale- dependent time patterns. timeZone String or java.util.TimeZone Yes The time zone to use instead of the default parseLocale String or java.util.Locale Yes A locale to be used instead of the default. var String No The variable name. The type is java.util.Date. scope String No The variable scope. Example <fmt:parseDate value="${param.emDate}" pattern="yyyy-MM-dd" /> <fmt:parseNumber> The <fmt:parseNumber> action parses a number formatted according to locale-specific rules. A custom pattern can be specified or a locale specific default pattern for a certain number type (currency, percentage, or a regular number) can be used. The locale used is the one explicitly specified or is taken from the locale configuration setting or the locale from the localization context setting. If none of these are set, the locale is determined as the best match for the user preferences (Accept-Language request header). Syntax 1: Without a body <fmt:parseNumber value="number" [pattern=" pattern" | type="number|currency|percent"] [parseLocale=" locale"] [integerOnly="true|false"] [var=" var" [scope="page|request|session|application"]] /> Syntax 1: With a body <fmt:formatNumber [pattern=" pattern" | type="number|currency|percent"] [parseLocale=" locale"] [integerOnly="true|false"] [var="var" [scope="page|request|session|application"]]> number </fmt:parseNumber> . Attributes Attributename Java type Dynamic valueaccepted Description value String Yes The date and time to parse pattern String Yes A custom pattern in the form accepted by java. text.SimpleDateFormat;. locale- dependent time patterns. timeZone String or java. util.TimeZone Yes The time zone to use instead of the default parseLocale String or java. util.Locale Yes A locale to be used instead. A locale to be used instead of the default. var String No The variable name. The type is java. util.Date. scope String No The variable scope. Example <fmt:parseDate value="${param.emDate}"

Ngày đăng: 13/08/2014, 21:21

Từ khóa liên quan

Tài liệu cùng người dùng

Tài liệu liên quan