Click to See Complete Forum and Search --> : CustomTag in JSP


daina
02-06-2006, 03:11 AM
Hi

I did one sample custom tag like this.But an error is comming as According to the TLD attribute UserName is mandatory for tag myTag.It is not showing the textbox to enter.Can anybody tell me what should I do for it.
In the JSP page I gave like this

<code>

<%@ taglib uri="/myTLD" prefix="easy" %>
<form name="form1" method = "post" action = "" >
<table border = 2>
<tr>
<td>
<b>User Id :</b>
</td>
<td>
<input type=text name= UserId>
</td>
</tr>
<tr>
<td>
<b>User Name :</b>
</td>
<td>
<input type = text name = UserName>
</td>
</tr>
<input type = submit value = Submit>
<easy:myTag value="<%=request.getParameter(\"UserName\")%>">
</easy:myTag>
<easy:myTag value="<%=request.getParameter(\"UserId\")%>">
</easy:myTag>
</table>
</form>

</code>

Test.tld:----

<?xml version="1.0" encoding="ISO-8859-1" ?>
<!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.1</jspversion>
<shortname>JSP</shortname>
<tag>
<name>myTag</name>
<tagclass>Sample.MyCustomTag</tagclass>
<attribute>
<name>UserName</name>
<required>true</required>
</attribute>
<attribute>
<name>UserId</name>
<required>true</required>
</attribute>
</tag>
</taglib>