MyTag
package taglib;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
import java.io.IOException;
public class MyTag extends TagSupport
{
public int doStartTag() throws JspException
{
return EVAL_BODY_INCLUDE;
}
public int doAfterBody() throws JspException
{
System.out.println("Hello!");
return SKIP_BODY;
}
}
MyTag.tld
PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"
"http://java.sun.com/dtd/web-jsptaglibrary_1_2.tld">
1.0
1.2
taglib1
http://rntsoft.com/taglibs
A simple tag library
log
taglib.MyTag
TAGDEPENDENT
Log a message.
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
Jsp page with custom tag
<%@ taglib uri="http://rntsoft.com/taglibs" prefix="l"%>
Creating a Simple Custom Tag
Creating a Simple Custom Tag
I'm sending some text to the server console!