• 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
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

difference between tag defined in tld and a tag file.

 
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ranchers,

If i defined a custom tag in tld (lets say "myTag") and also a tag file with same name (myTag.tag). Then what will be the behavior ??

Do i need two taglib directive to access them ?
Are both the tags be defined in same namespace ?



Thanks in advance,
Abhishek
 
Ranch Hand
Posts: 324
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The tag files are just another way to include your your component web pages. It allow to treat your page as tag.
The custom tags are much powerful than tag files as tag files are the JSPs where custom tags are java classes.

Do i need two taglib directive to access them ?


Yes and you can differentiate then with different prefix.
 
Ranch Hand
Posts: 572
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are writing Tag Files then it doesn't require you to define it in TLD file unless its in jar file where you write its path in TLD file only.

So, to access both tags, you will require two Tag lib directives one for Tag file and other for Tag handler. For Tag file you'll have to use tagdir attribute in taglib directive whereas for Tag Handler(TLD) use uri for locating TLD and obviously the prefix of both should be different.

Note that you can't use both tagdir and uri at the same time in taglib directive, so you can't use both with same prefix.
 
Abhishek Sharma
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well do they share same name space...
Any comments on that ???
 
Ali Gohar
Ranch Hand
Posts: 572
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Well do they share same name space



what do you mean by this?
 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think that if you put the custom tag mapping and tagfile mapping (in case the tag file is put in a JAR) in the same TLD file, then you cannot use the same name for both of them. But if only the custom tag is present in the TLD, and the tag file is placed in /WEB-INF/tags, then you can use the same name for both (because you will use two taglib directives, one with "uri" attribute for the custom tag, and one with "tagdir" attribute for the tag file)
 
    Bookmark Topic Watch Topic
  • New Topic