I am dealing with problem in JSP. Basically, I want to take float number such as 0.4311223 and turn it to 4 here is how I do it:
<c:set var="age" value="${(0.4311223 * 10)}" />
<fmt:formatNumber var="ageRatio"
type="number"
value="${age}"
maxFractionDigits="0"/>
Age ratio: ${ageRatio}<br />
It prints empty string, when I print ${age} it prints correct value of 4.311223.
Did you include the taglib?
Please try to add the
minFractionDigitsattribute. I think you can remove thetypeattribute too.