• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

Custom tag confusion.

 
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
 
Ranch Hand
Posts: 227
  • 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.
 
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 ]
 
I would challenge you to a battle of wits, but I see you are unarmed - shakespear. Unarmed tiny ad:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic