File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes tagdir Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "tagdir" Watch "tagdir" New topic
Author

tagdir

Daniel Spritzer
Greenhorn

Joined: Apr 26, 2008
Posts: 10
Hello all,

I'm confused as to the purpose of the tagdir attribute in the taglib directive.

On page 492 of HFSJ 1.4, it gives an example:
<%@taglib prefix="mytags" tagdir="/WEB-INF/tags" %>

On page 499, it describes the 4 places the container will search for .tag files. So what exactly is the purpose of the tagdir if the container will only search 4 specific locations?

Thanks
Daniel
Bobby Sharma
Ranch Hand

Joined: Mar 18, 2008
Posts: 574
    
    1

Originally posted by Daniel Spritzer:
Hello all,

I'm confused as to the purpose of the tagdir attribute in the taglib directive.

On page 492 of HFSJ 1.4, it gives an example:
<%@taglib prefix="mytags" tagdir="/WEB-INF/tags" %>

On page 499, it describes the 4 places the container will search for .tag files. So what exactly is the purpose of the tagdir if the container will only search 4 specific locations?

Thanks
Daniel


According to the Jsp specs,The tag file should be particularly 4 places,
they are:
* WEB-INF/tags and the sub directory of it viz. WEB-INF/tags/foo
* META-INF/tags and the sub directory of it META-INF/tags/bar
Note:META-INF directory resides into lib directort(WEB-INF/lib)
so my friend,don't get frustrated because it's just the rule.

best regards,
omi
[ May 03, 2008: Message edited by: omi sharma ]

Back to Java , again.
Daniel Spritzer
Greenhorn

Joined: Apr 26, 2008
Posts: 10
Omi, Thanks for the reply. I understand *where* the container searches, I don't understand the *purpose* of the tagdir attribute.
Bobby Sharma
Ranch Hand

Joined: Mar 18, 2008
Posts: 574
    
    1

it's purpose is searching those dirs in which you put tag files.

best regards,
omi
Daniel Spritzer
Greenhorn

Joined: Apr 26, 2008
Posts: 10
Exactly, but if you already have 4 predefined locations of where the tag files can go, why is the 'tagdir' attribute necessary?
John Donoghue
Ranch Hand

Joined: Dec 20, 2007
Posts: 45

I may be wrong here, but I think that it is to prevent namespace collisions.

Say that one tag file had a function "sort" for cards. In another we have function "sort" for laundry (I know it is a silly example). If both are in the same web app in two different files in different directories, how does the container know which to use? The tagdir directive associates the first with the prefix "cards" and the second with the prefix "laundry", and then we use <cards:sort/> or <laundry:sort/> so the the container gets the right one.

-John


SCJP 5<br />SCBCD 1.3<br />SCJD<br />SCWCD 1.4, 5<br />SCBCD 5 -- working on it
Kumar Garlapati
Ranch Hand

Joined: Feb 04, 2008
Posts: 38
Good one John, thanks.


Regards,<br />Kumar
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: tagdir