JSTL fmt:parseNumber Formatting Tag

The JSTL <fmt:parseNumber> Formatting Tag is used for parsing the numbers, currencies and percentages.

Syntax:

<fmt:parseNumber value=”val” otherattributes />

fmt:parseNumber tag attributes:

Attribute Description Required
value Numeric value to read or parse. No
type NUMBER, CURRENCY, PERCENT. No
parseLocale Locale to use when parsing the number. No
integerOnly Whether to parse to an integer (true) or floating point number (false). No
pattern It specify the custom parsing pattern. No
timeZone It specify the time zone of the displayed date. No
var It specify the name of the variable to store the parsed number. No
scope It specify the scope of the variable to store the parsed number. No

Example:

test.jsp

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


  
 	fmt:parseNumber JSTL formatting tag example
  
  
    
    Number after parsing by setting type attribute: 

Number after parsing by setting integerOnly attribute to true:

web.xml


	
  
          test.jsp
  	


Output:

jsp example 44
 
Download this example.
 
Next Topic: JSTL fmt:formatDate Formatting Tag with example.
Previous Topic: JSTL fmt:formatNumber Formatting Tag with example.