core 태그는 끝! 

다음은 국제화 코드다 이거도 짧아

 

[FormatNumberTag]

국제화태그 쓸 땐 taglib 를 가져와야 겠지

 

국제화태그라이브러리
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>

 

필수 속성 : value

type속성의 기본값은 number(value에있는걸 숫자로 바꾸겠다)

groupingUsed속성 기본값은 true(천단위로 , 찍음)

 

공통으로 사용 할 변수 선언!

<c:set var="money" value="10000"/>

[필수 속성만 사용]

el로 출력

 ${money }

JSTL국제화 태그로 출력

<fmt:formatNumber value="${money }" />

JSTL국제화 태그로 출력 : 천 단위 콤마 생략(el로 출력과 똑같다)

<fmt:formatNumber value="${money }" groupingUsed="false"/>

type="currency" 일 때 현지 통화단위로 출력

<fmt:formatNumber value="${money }" type="currency"/>

type="currency" 일 때 통화 단위 $로 출력 (currencySymbol추가) 

<fmt:formatNumber value="${money }" type="currency" currencySymbol="$"/>

type="percent" 일 때  (숫자 *100)

<fmt:formatNumber value="${5/100 }" type="percent"/>

 

 

 

[원하는 위치에 출력 : var속성 이용]

 <fmt:formatNumber value="${money }" type="currency" var="price"/>
 <h4>위 가격을 아래에 출력</h4> 
 가격이 ${price} 내렸어요

'학원 > JSP' 카테고리의 다른 글

11/30 54-7 [JSP] FunctionsOfJSTL  (0) 2022.11.30
11/30 54-6 [JSP] FormatDateTag  (0) 2022.11.30
11/30 54-5 [JSP] CatchTag  (0) 2022.11.30
11/30 54-4 [JSP] OutTag  (0) 2022.11.30
11/30 54-3 [JSP] UrlTag(게시판짜기 TOP변경)  (0) 2022.11.30

+ Recent posts