Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Custom tag confusion.

 
Srinivasan Rengan
Ranch Hand
Posts: 122
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
Assume, we have a custom tag described in the JSP as following:

<mine:Function color="red"/>
The body content will surely hold a value EMPTY.

<mine:Function color="blue">This is a sample</mine:Function>
The body-content will be either JSP or scriptless or tagdependent.

But, what happens now?
<mine:Function color="yellow"></mine:Function>

HFSJ says that, this kind of a tag represents an empty body-content element.
But, when we but empty for body-content, and then write the above code in our JSP file, we get a flat exception saying that body is not allowed by the TLD.

Could some help in solving the above puzzle!!
I am confused!
Srini
 
Karthik Rajendiran
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Friend,

Empty Tag can be like this
1. Tag which ends like this /> For Ex <my:Tag user="name" />
2. There is absolutely nothing between opening and closing tag
<my:Tag></my:Tag>
NOTE: If there is single space also it is considered a non-empty tag
Make sure nothing is there between opening and closing tag.

3. Tag with body as <jsp:attribute>
<my:Tag>
<jsp:attribute name="user">karthik</jsp:attribute>

Please check whether you have typed any space between your opening and closing tags. IF space exists it is treated as non-empty tag.
 
Srinivasan Rengan
Ranch Hand
Posts: 122
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot for your reply.
I have not left a single space between the tags.
<mine:Function color="red"></mine:Function>.

This is exactly what I wrote.
 
Nicky Eng
Ranch Hand
Posts: 378
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
make sure your TLD file have the :

<body-content>empty</body-content>
[ October 05, 2005: Message edited by: Nicky Eng ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic