tags:

views:

122

answers:

1

How can I make a formatted output for a number (e.g. long or BigDecimal) in EL? For example, I want to limit a number of decimal digits to 3 in

${result.returnValue.contract.balance}
+4  A: 

Using <fmt:formatNumber/>

http://java.sun.com/products/jsp/jstl/1.1/docs/tlddocs/fmt/formatNumber.html

For example:

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

<fmt:formatNumber 
     value="${result.returnValue.contract.balance}" 
     maxFractionDigits="3"/>
skaffman