This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes question about tld Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "question about tld" Watch "question about tld" New topic
Author

question about tld

Kiril Nugmanov
Ranch Hand

Joined: Jul 09, 2008
Posts: 42
Hi guys,

In HFS there is a question about tld files:
Which is true about TLD files?
(A) TLD files may be placed in any subdirectory of WEB-INF.
(B) TLD files are used to configure JSP environment attributes, such as scripting-invalid.
(C) TLD files may be placed in the META-INF directory of WAR file.
(D) TLD files can declare both Simple and Classic tags, but TLD files are NOT used to declare Tag Files.

Correct answer is: A.

But as I know it cant be placed in to WEB-INF/classes directory or it states that ok it can be placed but won't work?


SCJP5, SCWCD5, SCBCD5, OCPJWSD5, OCMJEA 5
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

TLD files should not be placed in /WEB-INF/classes or /WEB-INF/lib. It's not "must not", it's "should not", but I agree with you. I would not have answered A either. I would have rephrased it like :
(A) TLD files may be placed in any subdirectory of WEB-INF, except the "classes" and "lib" subdirectories.


[My Blog]
All roads lead to JavaRanch
Kiril Nugmanov
Ranch Hand

Joined: Jul 09, 2008
Posts: 42
Thanks Christophe.

Will contnue my jorney to the SCWCD5
Deepak Jain
Ranch Hand

Joined: Aug 05, 2006
Posts: 637
TLD Files can be placed in the following locations.
a) Directly within WEB_INF.
b) Under any subdirectory within WEB-INF. WEB-INF/*
c) Under META-INF inside a JAR file which is placed under WEB-INF/lib.
So for example if i have a jar file tags.jar then it must be placed under
WEB-INF/lib and therefore the tld can be placed under
WEB-INF/lib/tags.jar/META-INF
c) Under any subdirectory under META-INF inside a JAR file which is placed under WEB-INF/lib.
WEB-INF/lib/tags.jar/META-INF/*


SCJP, SCWCD, SCBCD
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

b) Under any subdirectory within WEB-INF. WEB-INF/*

Please check JSP.7.3.1 Identifying Tag Library Descriptors.
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

Originally posted by Christophe Verre:

Please check JSP.7.3.1 Identifying Tag Library Descriptors.


yes, i read it Christophe. but, i check that just placing the tld in /WEB-INF/lib/.tld file ...it is working well. what do you say about this ?
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

i check that just placing the tld in /WEB-INF/lib/.tld file ...it is working well.

The spec says that you should not place them there. It means that it may work, and the container you are using is fine with that. But it's not guaranteed for all containers. Otherwise the spec would not mention it at all.
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

Originally posted by Christophe Verre:
But it's not guaranteed for all containers. Otherwise the spec would not mention it at all.


yes,got it.Thanks Christophe
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: question about tld
 
Similar Threads
TLD file
HFSJ page 481 question 1
Mock Exam Doubts
Regarding TLD Location
problem while using tagdir