MyTag.java
package taglib;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
import java.io.IOException;
public class MyTag extends TagSupport
{
public int doStartTag() {
pageContext.setAttribute("names", "ValueInPageContext");
return SKIP_BODY;
}
}
MyTag.tld
"-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"
"http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">
1.0
1.2
TagExamples
Example tags.
iterator
taglib.MyTag
web.xml
"http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
Example web application illustrating the use of tags in the
"request" custom tag library, from the JAKARTA-TAGLIBS project.
http://rntsoft.com/taglibs
/WEB-INF/MyTag.tld
admin
index.jsp with custome tag
<%@ taglib prefix="l" uri="WEB-INF/MyTag.tld" %>
Supporting Cooperating Custom Tags
Supporting Cooperating Custom Tags
<%
out.print(pageContext.getAttribute("names"));
%>