//rntsoftYourOwnJSPTag.war
// add to web.xml
http://java.sun.com/jstl/rntsoft
/WEB-INF/rntsoft.tld
// create new rntsoft.tld file in WEB-INF directory
//File:rntsoft.tld
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
HelloWorldTag
com.rntsoft.HelloWorldTag
empty
// create HelloWorldTag.java under WEB-INF\classes\com\rntsoft\
// include jsp-api.jar into your CLASSPATH
// and compile it
package com.rntsoft;
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 from www.rntsoft.com!");
}
catch(Exception e)
{
throw new JspException(e.getMessage());
}
return EVAL_PAGE;
}
}
// create JSP file: HelloWorldTag.jsp
<%@ taglib uri='WEB-INF/rntsoft.tld' prefix='hw' %>
// start tomcat and load the JSP file in the browser