The formatDate tag formats date and time data according to a specified style and pattern.

<fmt:formatDate> tag attribute(s):

Attribute

Required

Description

value

Yes

The date/time to be formatted.

type

No (default=date)

Specifies if the data to be formatted contains a date, time, or both.

dateStyle

No

Formatting style used for dates. The valid style values are defined by the
java.text.DateFormat class. (i.e., default, short, medium, long, and full). Valid only if
the type attribute is date or both.

timeStyle

No

Formatting style used for time values. The valid style values are defined by the
java.text.DateFormat class (i.e., default, short, medium, long, and full). Valid only if
the type attribute is time or both.

pattern

No

Custom formatting pattern for dates and times. The patterns are specified by the
java.text.SimpleDateFormat class. See table below.

timeZone

No

Time zone to be used for the time information.

var

No

Variable containing the parsed date/time value. This variable is of type java.util.Date

scope

No (default=page)

Scope of the var variable. This optional attribute can be page, request, session, or
application.

Specifies if the value is to be parsed; contains a date, time, or both.

dateStyle

No

Formatting style used for dates. The valid style values are defined by the
java.text.DateFormat class. (i.e., default, short, medium, long, and full). Valid only if
the type attribute is date or both.

timeStyle

No

Formatting style used for time values. The valid style values are defined by the
java.text.DateFormat class (i.e., default, short, medium, long, and full). Valid only if
the type attribute is time or both.

pattern

No

Custom formatting pattern. The patterns are as specified by the
java.text.DecimalFormat class. See table below.

timeZone

No

Time zone to be used for the time information.

parseLocale

No

Locale to be used for formatting date and time values.

var

No

Variable that contains the parsed date/time value. This variable is of type
java.util.Date.

scope

No (default=page)

Scope of the var variable. This is an optional attribute and can be page, request,
session, or application

Custom pattern symbol,
location, localized, and meaning:

Symbol

Location

Localized

Meaning

0

Number

Yes

Digi

#

Number

Yes

Digit, zero shows as absent

.

Number

Yes

Decimal separator or monetary decimal separator

-

Number

Yes

Minus sign

,

Number

Yes

Grouping separator

E

Number

Yes

Separates mantissa and exponent in scientific notation.
Need not be quoted in prefix or suffix.

;

Subpattern boundary

Yes

Separates positive and negative subpatterns

%

Prefix or suffix

Yes

Multiply by 100 and show as percentage

\u2030

Prefix or suffix

Yes

Multiply by 1000 and show as per mille value

¤ (\u00A4)

Prefix or suffix

No

Currency sign, replaced by currency symbol. If
doubled, replaced by international currency symbol.
If present in a pattern, the monetary decimal separator
is used instead of the decimal separator.

'

Prefix or suffix

No

Used to quote special characters in a prefix or suffix,
for example, "'#'#" formats 123 to
"#123". To create a single quote
itself, use two in a row: "# o''clock".

requestEncoding

The <fmt:requestEncoding> tag is used to specify the character encoding of the request an used to decode
the incoming forms data entered by the user. Use this if the encoding used is different from the ISO-8859-1.

The syntax is as follows:

<fmt:requestEncoding [value="character encoding name"] />

Attribute(s):

Attribute

Required

Description

value

No

The name of the character encoding for the request. Examples of request encodings
include UTF-8, ISO-8859-1, and so on. A complete list of encoding codes can be
found here.

This file starts with the normal xml tag for a XML file and
the root tag for the deployment descriptor is web-app. Every ting
inside the last tag is to tell the server about our application,
which in this case is a JSP file.

With a servlet tag we give the JSP file a servlet name,
which is used in the servlet-mapping tag to specify a url
for the JSP file.

In this way we can have many urls for the same JSP file.

If no session-timeout (the server ends the service
of the application after this time) is given a standard timeout for the server is used
as timeout for the application.

The welcome-file tag specifies the startup for our application,
which in this case and our application is the welcome file with url FormattingJSP.
Reorganize the welcome-file-list to what is shown above.

Creating Web-server Deployment descriptor.

The context-root (in example /FormattingJSTL) for the application
will in most cases be specified by a server vendor deployment descriptor.