프로그래밍/JSTL

JSTL 콤마(,) 또는 소수점 사용법

미냐님 2020. 4. 3. 21:44
728x90

콤마(,) 또는 소수점 사용법

 

<fmt:formatNumber value="12341234" type="number"/>
// 결과 : 12,341,234 ( 천 단위마다 ","로 끊어줌 )

<fmt:formatNumber value="1234" type="currency" currencySymbol="₩"/>
// 결과 : ₩1234.00 ( ₩표시 붙인 후, 천 단위마다 "," 표시 후 소수점 2자리까찌 표현함 )

<fmt:formatNumber value="0.35" type="percent"/>
// 결과 : 35% ( %로 표현함 )

<fmt:formatNumber value="1234.1234" pattern=".00"/>
// 결과 : 1234.12 ( pattern 에 표시한 자리수만큼 반올림함 )

<fmt:parseNumber var="test" value="1234.12" integerOnly="true" />
// 결과 : var에 test라고 선언 한 값을 출력 시 ( ${test} 소수점 이하 버림 ) > 1234
728x90