jstl_fmt_ex.jsp > MODEL

본문 바로가기

사이트 내 전체검색

뒤로가기 MODEL

jstl_fmt_ex.jsp

페이지 정보

작성자 관리자 작성일 21-07-15 19:48 조회 471 댓글 0

본문

<%@ page language="java" contentType="text/html; charset=UTF-8"%>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 

<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>


<html>

<head>

<title>JSTL fmt 라이브러리 사용 예제</title>

</head>

<body>


<fmt:formatNumber value="100200300.45" type="number"/><br> 

<fmt:formatNumber value="50000" type="currency"/><br>

<fmt:formatNumber value="50000" type="currency" currencySymbol=""/><br> 

<fmt:formatNumber value="0.15" type="percent"/><br>

<fmt:formatNumber value="500567300" pattern="###,###,###"/><br><br>


<%

int num=50000;

int num2=500567300;

%>

<c:set var="num" value="0.15"/>

<c:set var="num2" value="500567300"/>


<fmt:formatNumber value="<%=num %>" type="currency"/><br>

<fmt:formatNumber value="${num }" type="percent"/><br>

<fmt:formatNumber value="<%=num2 %>" pattern="###,###,###"/><br>

<fmt:formatNumber value="${num2 }" pattern="###,###,###"/><br><br>



<jsp:useBean id="date" class="java.util.Date"/> 


<fmt:formatDate value="${date}" type="date"/><br>

<fmt:formatDate value="${date}" type="time"/><br>

<fmt:formatDate value="${date}" type="both"/><br><br>


<fmt:formatDate value="${date}" type="both" timeStyle="short" dateStyle="short"/><br>

<fmt:formatDate value="${date}" type="both" timeStyle="long" dateStyle="long"/><br><br>


</body>

</html>

추천0

댓글목록 0

등록된 댓글이 없습니다.


Copyright © dancePKT. All rights reserved.
PC 버전으로 보기