Formating Tag's in JSTL


Description about JSTL formatting tag:

The format tag library provides the support for internalization. This provides the formatting of data in different domains. The data can be dates, numbers, or the time specifications in different domains.

The syntax for it is:

<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>

JSTL formatting tags are divided in to four categories:

  1. Basic Formatting Tags
  2. Number Formatting Tags
  3. Date Formatting Tags
  4. Time Zone Tags

Basic Formatting Tags: These tags are used to format the data of a jsp page. These tags parse the data based on the current locale.

Types of Basic Formatting Tags:

  • <fmt:setLocale>
  • <fmt:setBundle>
  • <fmt:bundle>
  • <fmt:message>
  • <fmt:param>
  • <fmt:requestEncoding>

Number Formatting Tags: It is used  to Format the number data. This Tags include the currency _ related  formatting, number parsing and Formatting. It is also used for the percentage formatting.

Types of number Formatting Tags:

  • <fmt:formatNumber>
  • <fmt:parseNumber>

Date Formatting Tags: These Tags are used to format date type of data. It help in formatting the date_ time data.

 Types of date formatting tags:

  • <fmt:formatDate>
  • <fmt:parseDate>

Time Zone Formatting Tags: It is used to format the time zone type of data. These tags help in setting and specifies the time zone.

Types of Time Zone Formatting Tags:

  • <fmt:timeZone>
  • <fmt:setTimeZone>

Example:

index.jsp:

codingindex.gif

number.jsp:

codingnumber.gif

OUTPUT:

index.jsp:

index.gif

number.jsp:

number.gif


Similar Articles