Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

tag

fmt:parseNumber tag

JSP Standard Label LibraryJSP Standard Tag Library

fmt:parseNumberThe tag is used to parse numbers, percentages, and currencies.

Syntax format





property

fmt:parseNumberThe tag has the following attributes:

property Description Whether it is required Default value
value The number to parse No Body
type NUMBER, CURRENCY, or PERCENT No number
parseLocale The locale used when parsing the number No The default locale
integerOnly Whether to parse only integers (true) or floating-point numbers (false) No false
pattern A custom parse pattern No None
timeZone The time zone of the date to display No The default time zone
var The variable that stores the number to be parsed No Print to page
scope The scope of the var attribute No page

The pattern attribute has the same effect as the pattern in thefmt:formatNumbertag. When parsing, the pattern attribute tells the parser the expected format.


Example Demonstration



<%@ page language="java" contentType="text/html; charset=UTF-8"

    pageEncoding="UTF-8"%>

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

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





  JSTL fmt:parseNumber 标签





数字解析:

数字解析 (1) :

数字解析 (2) :

The running result is as follows:

数字解析:



数字解析 (1) : 1250003.35



数字解析 (2) : 1250003


JSP Standard Label LibraryJSP Standard Tag Library