// Sample tld file
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
Mark's Simple Tags
HelloWorldTag
test.HelloWorldTag
empty
// Sample JSP file
<%@ taglib uri='webapp/META-INF/simple.tld' prefix='hw' %>
// Sample Java file
package test;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
import java.util.*;
public class HelloWorldTag extends TagSupport
{
public int doStartTag() throws JspException
{
try
{
JspWriter out = pageContext.getOut();
HttpServletResponse response = (HttpServletResponse)pageContext.getResponse();
out.write("Hello world!");
}
catch(Exception e)
{
throw new JspException(e.getMessage());
}
return EVAL_PAGE;
}
}