๐ป
JSP ํ๋ก๊ทธ๋๋ฐ - [JSTL] functions ๋ณธ๋ฌธ
function tags
ํ์ค ํจ์๋ฅผ ์ ๊ณตํ๋ค. ๋๋ถ๋ถ์ ์ผ๋ฐ์ ์ผ๋ก ๋ฌธ์์ด ์กฐ์์ ์ํ ํจ์์ด๋ค.
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ 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="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<c:set var="str1" value="Function ํ๊ทธ๋ฅผ ์ฌ์ฉํฉ๋๋ค."/>
<c:set var="str2" value="์ฌ์ฉ"/>
<c:set var="str3" value="1,2,3,4,5,6,7,8,9,10"/>
<h3>${str1}</h3>
<h3><c:out value="${str2}"/></h3>
<h3>${str3}</h3>
<br /><br />
<div>
1. ๋ฌธ์์ด๊ธธ์ด: ${fn:length(str1)} <br />
2. ๋๋ฌธ์: ${fn:toUpperCase(str1)} <br />
3. ์๋ฌธ์: ${fn:toLowerCase(str1)} <br />
4. ๋ฌธ์์ด์ถ์ถ: ${fn:substring(str1,3,6)} <br />
5. ๋ฌธ์์ด์นํ: ${fn:replace(str1, " ", "-")} <br />
6. ๋ฌธ์์ด์์น: ${fn:indexOf(str1, "t")} <br />
7. ๋ฌธ์์ด1์์ ๋ฌธ์์ด2์ ํฌํจ๋์ด ์๋ ๋ฌธ์์ด ์ดํ: ${fn:substringAfter(str1, str2)}<br />
8. ๋ฌธ์์ด1์์ ๋ฌธ์์ด2์ ํฌํจ๋์ด ์๋ ๋ฌธ์์ด ์ด์ : ${fn:substringBefore(str1, str2)}<br />
9. ์์๋ฌธ์์ด: ${fn:startsWith(str1, 'Fun')}<br />
10. ๋๋ฌธ์์ด:${fn:endsWith(str1,'์ฌ์ฉํฉ๋๋ค.')} <br/>
11. ๋๋ฌธ์์ด๊ธธ์ด ํฌํจ: ${fn:contains(str1, str2)} <br />
12. ๋๋ฌธ์์ด ํฌํจ(๋์๋ฌธ์๊ตฌ๋ถ์ํจ): ${fn:containsIgnoreCase(str1,str2)}<br/>
๋ฌธ์์ด ๋ถ๋ฆฌํด์ ๋ฐฐ์ด๋ก ๋ฐํ
<c:set var="array" value="${fn:split(str3, ',')}"/>
<c:forEach var="i" items="array">
${i}
</c:forEach> <br />
๋ฌธ์์ด ํฉ์น๊ธฐ
${fn:join(array,"*")}
</div>
</body>
</html>
๋ฐ์ํ
'KITRI > JSP' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
JSP ํ๋ก๊ทธ๋๋ฐ - ๋ก๊ทธ๋ฉ์์ง/ ํ๋ฌ๊ทธ์ธ ๋ค์ด (0) | 2020.06.30 |
---|---|
JSP ํ๋ก๊ทธ๋๋ฐ - [MVC] FrontController ํจํด (0) | 2020.06.30 |
JSPํ๋ก๊ทธ๋๋ฐ - [JSTL] fmt (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 |
Comments