This code will help you to write custom tags :
tld file
========
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN" "http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd">
<taglib>
<tlibversion>1.0</tlibversion>
<jspversion>1.2</jspversion>
<shortname>html</shortname>
<tag>
<name>text</name>
<tagclass>org.custom.tags.TextField</tagclass>
<bodycontent>empty</bodycontent>
<attribute>
<name>property</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
</taglib>
tag class
==========
package org.custom.tags;
import javax.servlet.jsp.tagext.TagSupport;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.JspException;
public class TextField extends TagSupport{
private
String strProperty = null;
public void setProperty(String property){
this.strProperty = property;
}
public String getProperty(){
return this.strProperty;
}
public int doStartTag(){
try{
JspWriter outStream = pageContext.getOut();
System.out.println("jhsdk");
outStream.println("<input type='text'>");
}catch(Exception exception){
}
return EVAL_PAGE;
}
}
jsp file
=========
<%@ page import="java.util.ArrayList"%>
<%@ taglib uri="/tags/custom-html" prefix="html" %>
<HTML>
<HEAD>
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<META name="GENERATOR" content="IBM WebSphere Studio">
<META http-equiv="Content-Style-Type" content="text/css">
<LINK href="../theme/Master.css" rel="stylesheet" type="text/css">
<TITLE>tag.jsp</TITLE>
</HEAD>
<BODY>
<table width="100%">
<html:text/>
</table>
</BODY>
</HTML>