| Author |
difference between tag defined in tld and a tag file.
|
Abhishek Sharma
Ranch Hand
Joined: Jan 09, 2006
Posts: 68
|
|
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
Joined: Nov 14, 2005
Posts: 324
|
|
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.
|
"Know where to find the solution and how to use it - that's the secret of success."
|
 |
Ali Gohar
Ranch Hand
Joined: Mar 18, 2004
Posts: 572
|
|
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
Joined: Jan 09, 2006
Posts: 68
|
|
Well do they share same name space... Any comments on that ???
|
 |
Ali Gohar
Ranch Hand
Joined: Mar 18, 2004
Posts: 572
|
|
Well do they share same name space
what do you mean by this?
|
 |
H Pathak
Greenhorn
Joined: Dec 20, 2006
Posts: 28
|
|
|
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)
|
SCJP 1.4 - cleared<br />SCWCD 1.4 - cleared!!
|
 |
 |
|
|
subject: difference between tag defined in tld and a tag file.
|
|
|