How do I format a variable with <fmt:formatNumber> ? I'm learning JSTL and converting from old Struts tags. This doesn't work. It can't read the distance variable!
<%double distance=geo.getDistance(geo.getLatitude(), geo.getLongitude(), lat, lng);%>
<c:set var="distanceEL" value="${distance}"/>
${distance},
<fmt:formatNumber pattern="0.0" value="${distance}"/>,
<fmt:formatNumber pattern="0.0" value="${distanceEL}"/>,
<fmt:formatNumber pattern="0.0" value="1234.567"/>,
<%= new java.text.DecimalFormat("0.0").format(distance) %>
It displays as
, , , 1234.6, 19.3
I'm using JSTL 1.2. So far I'm not impressed.