aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes difference between tag defined in tld and a tag file. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "difference between tag defined in tld and a tag file." Watch "difference between tag defined in tld and a tag file." New topic
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!!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: difference between tag defined in tld and a tag file.
 
Similar Threads
v:image tag in a jsp?
Taglib Question (enthruware)
customer tag
Question on Tag files
Custom Tag inhertance.