JSTL Parse Number Example:
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> <html> <head> <title>JSTL Parse Number Example</title> </head> <body> <!-- Setting Locale to US --> <fmt:parseNumber value="156.1432" var="test" integerOnly="TRUE" type="NUMBER"></fmt:parseNumber> <c:out value="${test}"></c:out> </body> </html>
As you can see above, JSTL Parse Number Tag is used to parse the number. Parse Number Tag in JSTL has following attributes.
1. value : Value attribute provides the number to be parsed.
2. type: Type attribute specifies the type of string to be parsed. It can be NUMBER, PERCENT or CURRENCY.
3. var : Var attribute provides the variable that is used to store the parsed number. This variable can be used later in the jsp.
4. intgerOnly: integerOnly attribute allows to store number in Integer format only. Default value is false.
5. pattern: Pattern attribute provides custom formatting pattern that determines how the string in the value attribute is to be parsed.
6. scope: Scope attribute provides the scope of variable.
Strategy Design Patterns We can easily create a strategy design pattern using lambda. To implement…
Decorator Pattern A decorator pattern allows a user to add new functionality to an existing…
Delegating pattern In software engineering, the delegation pattern is an object-oriented design pattern that allows…
Technology has emerged a lot in the last decade, and now we have artificial intelligence;…
Managing a database is becoming increasingly complex now due to the vast amount of data…
Overview In this article, we will explore Spring Scheduler how we could use it by…