Download
FAQ
History
PrevHomeNext API
Search
Feedback
Divider

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 the NumberFormat.getXXXInstance(locale) method, where XXX can be Currency, Number, or Percent, 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 and fmt:parseDate tags to handle localized dates, and fmt:formatNumber and fmt:parseNumber tags to handle localized numbers, including currency values. For more information on the JSTL formatting tags, see Formatting Tags (page 705). The JSTL version of Duke's bookstore uses the fmt:formatNumber tag to format book prices and the fmt:formatDate tag to format delivery dates.

Divider
Download
FAQ
History
PrevHomeNext API
Search
Feedback
Divider

All of the material in The Java(TM) Web Services Tutorial is copyright-protected and may not be published in other works without express written permission from Sun Microsystems.