Tuesday

JSTL format number

Add following taglib to your class:
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>

<fmt:formatNumber value="${your double value}" maxFractionDigits="0"  groupingUsed="false" />
<!-- your value example :1500.0 then it will show 1500 ! -->
<!-- You can use it instead of <c:out /> which doesn’t have so much control for formatting -->

No comments:

Post a Comment