본문 바로가기

개발하자/JSP&Servlet

태그만들어 사용하기 예제

--> 실행결과

색상 : red, 속도 : 100
색상 : blue, 속도 : 200

 

 

 

car.Tag

==================================

 <%@tag pageEncoding="euc-kr"%>
 <%@ attribute name="speed" required="true" %>
 <%@ attribute name="color" required="true" %>
<div style="color:${color}">색상:${color},속도:${speed}</h1></div>

 

 

a.jsp

====================================

<%@ page language="java" contentType="text/html; charset=EUC-KR"
 pageEncoding="EUC-KR"%>
<%@ taglib prefix="myTag" tagdir="/WEB-INF/tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">
<title>Insert title here</title>
</head>
 <body>
<myTag:car color="red" speed="100" /><br/>
 <myTag:car color="blue" speed="200" /><br/>
 </body>
</html>

 

 

'개발하자 > JSP&Servlet' 카테고리의 다른 글

전달할값이 많을때 tag  (0) 2015.03.31
taglib,forEach사용해서 구구단출력  (0) 2015.03.31
태그파일 사용하기,속성값 전달  (0) 2015.03.31
blockUI  (0) 2015.03.28
jQuery BlockUI Plugin  (0) 2015.03.28