Download
FAQ History |
API
Search Feedback |
Date and Number Formatting
Java programs use the
DateFormat.getDateInstance(int,
locale)
to parse and format dates in a locale-sensitive manner. Java programs use theNumberFormat.get
XXX
Instance(locale)
method, whereXXX
can beCurrency
,Number
, orPercent
, to parse and format numerical values in a locale-sensitive manner. The servlet version of Duke's Bookstore uses the currency version of this method to format book prices.JSTL applications use the
fmt:formatDate
andfmt:parseDate
tags to handle localized dates and use thefmt:formatNumber
andfmt:parseNumber
tags to handle localized numbers, including currency values. For information on the JSTL formatting tags, see Formatting Tags. The JSTL version of Duke's bookstore uses thefmt:formatNumber
tag to format book prices and thefmt:formatDate
tag to format the ship date for an order:The JavaServer Faces version of Duke's Bookstore uses date/time and number converters to format dates and numbers in a locale-sensitive manner. For example, the same shipping date is converted in the JavaServer Faces version as follows:
For information on JavaServer Faces converters, see Using the Standard Converters.
Download
FAQ History |
API
Search Feedback |
All of the material in The J2EE(TM) 1.4 Tutorial is copyright-protected and may not be published in other works without express written permission from Sun Microsystems.