/// Empty Tag
/rntsoft
/WEB-INF/rntsoft.tld
// create File:rntsoft.tld in the /WEB-INF/
PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"
"http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">
1.0
1.2
rntsoft Simple Tags
emptyTag
com.rntsoft.EmptyTag
empty
//compile the following code into WEB-INF\classes\com\rntsoft
package com.rntsoft;
import java.io.IOException;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.TagSupport;
public class EmptyTag extends TagSupport
{
public int doStartTag() throws JspException
{
try
{
pageContext.getOut().print("in EmptyTag.doStartTag()");
}
catch (IOException e)
{
System.out.println("Error in EmptyTag.doStartTag()");
e.printStackTrace();
throw new JspException(e); // throw the error to the error page (if set)
} // end of try-catch
return SKIP_BODY;
}
}
// start comcat and load the following jsp page in browser
<%@ taglib uri="/rntsoft" prefix="rntsoft" %>
A custom tag: empty
This page uses a custom tag that has neither attributes nor body content.
Here is its output: