• Post Reply Bookmark Topic Watch Topic
  • New Topic

problem in Custom Tags  RSS feed

 
Srinivas Genji
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
Here is my demo TLD file where i have created two tags having same tag class.Whether it is possible to have two or more tags with same Tag class(Tag Handler).

<tag>
<name>hello</name>
<tagclass>tags.HelloTag</tagclass>
<bodycontent>empty</bodycontent>
<info>Say Hi</info>
</tag>

<tag>
<name>parameters</name>
<tagclass>tags.HelloTag</tagclass>
<bodycontent>empty</bodycontent>
<info>Tag with Parameter</info>
<attribute>
<name>name</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
</taglib>


Here is my Jsp file

<%@ taglib uri="/WEB-INF/mytaglib.tld" prefix="first" %>
<HTML>
<HEAD>
<TITLE>Hello Tag</TITLE>
</HEAD>

<BODY bgcolor="#f4f4f4">
<B>My first tag prints</B>:
<first:hello/>

<B>My parameterized tag prints</B>:
<first arameters name="javaGuru"/>

<br>
</BODY>
</HTML>

when i run the JSP file,it dereference only the first tag.
Please point out where i went wrong

Thanks in advance
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It should be fine to define multiple tags using the same class...

What do you mean by "it dereferences only the first tag"? What do you see in the output of the page?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!