728x90
콤마(,) 또는 소수점 사용법
- jsp 페이지 상단에 아래의 코드를 선언 하고 사용한다.
- <%@ taglib prefix=”fmt” uri=”http://java.sun.com/jsp/jstl/fmt” %>
<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
'프로그래밍 > JSTL' 카테고리의 다른 글
[JSTL] substring 문자열 자르기 (0) | 2020.06.09 |
---|---|
< c:choose >< c:when > 다중(중복, 여러번) 사용 하기 (< c:choose >< c:when >안에 < c:choose >) (0) | 2020.04.03 |
JSTL < c:if >, < c:choose > 태그 사용법 (0) | 2020.04.03 |