v myfirsttag hello hello Hello Custom Tag v














- Slides: 14





문자열 출력 커스텀 태그 작성 절차 v <myfirsttag: hello /> § 태그 hello는 몸체는 없으며 문 자열 “Hello Custom Tag!!!”를 출력 v 필요 파일 순서 이름 장소 파일 이름 1 태그 클래스 작성 [Java Resources: src] Hello. Custom. Tag. java 2 TLD 작성 [WEB-INF/tld] Hello. Custom. Tag. tld 3 태그 활용 JSP 작성 [Web. Content] Hello. Custom. Tag. jsp 5


TLD 파일과 JSP 파일 작성 v TLD 파일 v JSP 파일 <%@ page language="java" content. Type="text/html; charset=EUC-KR" page. Encoding="EUC-KR"%> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=EUC-KR"> <title>커스텀 태그</title> </head> <body> <%@ taglib uri="/WEB-INF/tld/Hello. Custom. Tag. tld" prefix="myfirsttag" %> <H 2>첫 커스텀 태그 예제 </H 2> <center><HR> <myfirsttag: hello /> </center> </body> </html> 7

속성이 있는 커스텀 태그 만들기 v 테이블 출력 커스텀 태그 작성 절차 순서 이름 장소 파일 이름 비고 1 태그 처리기 [Java Resources: src] Select. Student. Tag. java 속성에 대한 setter getter 2 TLD [WEB-INF/tld] Select. Student. Tag. tld 속성 처리 3 태그 활용 JSP 프로그램 [Web. Content] Select. Student. Tag. jsp 8




Multiplication. tag <%@ tag body-content="scriptless" page. Encoding="euc-kr" description="구구단(multiplication table) 출력태그"%> <%@ attribute name="begin" %> <%@ attribute name="end" %> <%@ attribute name="bgcolor" %> <%@ taglib prefix="c" uri="http: //java. sun. com/jsp/jstl/core" %> <c: if test="${empty(begin)}" var="bool"> <c: set var="begin" value="2" /> </c: if> <c: if test="${empty(end)}" var="bool"> <c: set var="end" value="9" /> </c: if> <c: if test="${empty(begin)}" var="bool"> <c: set var="bgcolor" value="white" /> </c: if> <center> <H 2><jsp: do. Body /></H 2> <table width=100% border=1 cellpadding=1 bgcolor="${bgcolor}" > <c: for. Each var="i" begin="${begin}" end="${end}" > <tr align="center" > <c: for. Each var="j" begin="1" end="9" > <td>${i} * ${j} = ${i * j}</td> </c: for. Each> </tr> </c: for. Each> </table> </center> 12 <p><hr>

JSP 프로그램과 결과 <%@ page language="java" content. Type="text/html; charset=EUC-KR" page. Encoding="EUC-KR"%> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=EUC-KR"> <title>커스텀 태그</title> </head> <body> <h 2> 태그 파일을 이용한 커스텀 태그 : multiplication </h 2> <hr> <%@ taglib tagdir="/WEB-INF/tags" prefix="mytag" %> <mytag: multiplication> 구구단(2단에서 9단까지) </mytag: multiplication> <mytag: multiplication end="5" bgcolor="linen"> 구구단(2단에서 5단까지) </mytag: multiplication> <mytag: multiplication begin="3" end="7" bgcolor="yellow"> 구구단(3단에서 7단까지) </mytag: multiplication> </body> </html> 13

www. dongyang. ac. kr
Good morning hello
Hello hello hello how are you
Hello hello hello what's your name
Jeden morgen beginnt ein neuer tag
Guten tag hallo wie geht's
How to write banter
Hello custom
Hello good afternoon teacher
Hello pt
Hope you are all good
Small head fat body
Hello peter pan
Hello hello nursery
Hello hello to everyone it's english time
Hello my friend friend of a friend