2019.02.18 JSPL functions

2019. 2. 18. 14:11JSP

#라이브러리 태그 추가

1
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
cs


#사용 예제

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>function</title>
</head>
<body>
    <c:set var="text" value="동해물과 백두산이 마르고 닳도록"/>
    <c:if test=""></c:if>
    substring : ${fn:substring(text,1 ,10)}</br>
    trim : ${fn:trim(text)}</br>
    replace : ${fn:replace(text,"백두산","금정산")}</br>
    indexOf : ${fn:indexOf(text,"백")}</br>
    length: ${fn:length(text)}</br>
    
</body>
</html>
cs