This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

difference between tag defined in tld and a tag file.

 
Abhishek Sharma
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
 
Amirr Rafique
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.
 
Ali Gohar
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?
 
Harshit Patel
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)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic