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?
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.
Joined: Apr 26, 2008
Omi, Thanks for the reply. I understand *where* the container searches, I don't understand the *purpose* of the tagdir attribute.
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.
SCJP 5<br />SCBCD 1.3<br />SCJD<br />SCWCD 1.4, 5<br />SCBCD 5 -- working on it