π»
JSPνλ‘κ·Έλλ° - [JSTL] fmt λ³Έλ¬Έ
formatting tags
μμνκ·Έλ λ©μμ§ νμ, λ²νΈ λ° λ μ§ νμ λ±μ μ§μνλ€.
κ΅μ ν λ μΉ μ¬μ΄νΈμμ ν μ€νΈ, μκ°, λ μ§ λ° μ«μλ₯Ό νμνκ³ νμννλλ° μ¬μ©νλ€.
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<h3>μ«μλ₯Ό λ¬Έμμ΄ λ³ν</h3>
number:
<fmt:formatNumber value="12345.678" type="number"/>
currency:
<fmt:formatNumber value="12345.678" type="currency"/>
<fmt:formatNumber value="12345.678" type="currency" currencySymbol="$"/>
percent:
<fmt:formatNumber value="12345.648" pattern=".0000"/> <%-- #, 0 --%>
<h3>λ¬Έμμ΄μ μ«μ λ³ν</h3>
<c:set var="str" value="${'1000'}"/>
<fmt:parseNumber var="pNum" value="${str}"/>
<fmt:parseNumber var="isu" value="55.7" integerOnly="true"/>
${isu}
<h3>λ μ§λ₯Ό λ¬Έμμ΄ λ³ν</h3>
<jsp:useBean id="date" class="java.util.Date"/>
<c:set var="today" value="${date}"/>
λ μ§: <fmt:formatDate value="${date}" type="date"/><br />
μκ°: <fmt:formatDate value="${date}" type="time"/><br />
λ μ§μκ°: <fmt:formatDate value="${date}" type="both"/><br />
λ μ§μκ°: <fmt:formatDate value="${date}" type="both" dateStyle="short" timeStyle="short"/><br />
λ μ§μκ°: <fmt:formatDate value="${date}" type="both" dateStyle="long" timeStyle="long"/><br />
ν¨ν΄: <fmt:formatDate value="${date}" pattern="yyyy-MM-dd HH:mm:ss"/><br />
<h3>λ¬Έμμ΄μ λ μ§ λ³ν</h3>
<c:set var="nowdate" value="2019-12-25 12:00:21"/>
<fmt:parseDate value="${nowdate}" pattern="yyyy-MM-dd HH:mm:ss"/>
<fmt:formatDate value="${now}" pattern="${date}"/>
</body>
</html>
λ°μν
'KITRI > JSP' μΉ΄ν κ³ λ¦¬μ λ€λ₯Έ κΈ
JSP νλ‘κ·Έλλ° - [MVC] FrontController ν¨ν΄ (0) | 2020.06.30 |
---|---|
JSP νλ‘κ·Έλλ° - [JSTL] functions (0) | 2020.06.29 |
JSP νλ‘κ·Έλλ° - [JSTL] core (0) | 2020.06.29 |
JSP νλ‘κ·Έλλ° - JSTL(JSP Standard Tag Library) λ€μ΄λ‘λ / c:set, c:remove (0) | 2020.06.10 |
JSP νλ‘κ·Έλλ° - EL, JSTL (0) | 2020.06.10 |
Comments