Download The Java™ Web Services Tutorial
Transcript
FORMATTING TAGS
cation deployment descriptor. Here is the declaration from the Duke’s Bookstore
descriptor:
<context-param>
<param-name>
javax.servlet.jsp.jstl.fmt.localizationContext
</param-name>
<param-value>messages.BookstoreMessages</param-value>
</context-param>
message Tag
The message tag is used to output localized strings. The following tag from catalog.jsp
<h3><fmt:message key="Choose"/></h3>
is used to output a string inviting customers to choose a book from the catalog.
The param subtag provides a single argument (for parametric replacement) to the
compound message or pattern in its parent message tag. One param tag must be
specified for each variable in the compound message or pattern. Parametric
replacement takes place in the order of the param tags.
Formatting Tags
JSTL provides a set of tags for parsing and formatting locale-sensitive numbers
and dates.
The formatNumber tag is used to output localized numbers. The following tag
from showcart.jsp
<fmt:formatNumber value="${book.price}" type="currency"/>
is used to display a localized price for a book. Note that since the price is maintained in the database in dollars, the localization is somewhat simplistic, because
the formatNumber tag is unaware of exchange rates. The tag formats currencies
but does not convert them.
Analogous tags for formatting dates (formatDate), and parsing numbers and
dates (parseNumber, parseDate) are also available. The timeZone tag estab-
695
Related documents
The J2EE™ 1.4 Tutorial
View - ITtestpapers.com
The Java™ Web Services Tutorial
THE J2EE™ 1.4 Tutorial in NetBeans
GridForce - University at Buffalo, Computer Science and
WebLogic Web Service
Guide for protecting boreholes
MIS User Manual (MoW, 2013)
Global - US English
Groundwater Monitoring for Pump Operators
HAZUS MR2 Hurricane User Manual Volume I
[1 ] Oracle® Enterprise Manager
MANUEL D`UTILISATION SOUS WINDOWS
Sun GlassFish Enterprise Server 21 Quick Start Guide
Wiley Java 2 Enterprise Edition 1.4 (J2EE 1.4) Bible