Forums Register Login

EPractice Lab reivew exam 1 ,about the directory of tag files

+Pie Number of slices to send: Send
 


Which of the following values of tagdir attribute of the taglib directive is invalid?
a. /WEB-INF/tags.
b. /META-INF/tags
c. /WEB-INF/tags/mytagidr
d./WEB-INF/custom-tags
Given answer is B.
The tagdir attribute is used to specify the directory where the tag extensions are installed.The valid values are
/WEB-INF/tags or any of its subdirectory.If any other value is given, a compilation error will occur.



I think d is invalid too. Tag files must be in /WEB-INF/tags or subdirectory in the web application. If it is in a jar file, it must be in /META-INF/tags.
If the tag file is within a jar file, it can only be refered by uri attribute, not tagdir attribute.

Reference:
https://coderanch.com/t/601954/java-Web-Component-OCEJWCD/certification/understand-tagdir-attribute-taglib-directive


1) Tag File is located in /WEB-INF/tags/ or one of its subdirectories
2) Tag File is located in /WEB-INF/lib/ in a Jar file and then inside the Jar file in a directory /META-INF/tags or one of its subdirectories

An URI can only be used if your are trying to access a Tag-file that is located in the Jar-file. The TLD will then tell the container where to find the Tag-file.
If you are using a Tag file located in /WEB-INF/tags (and the tagdir attribute in the JSP) the container will generate a TLD that will point to the Tag file, making the two possibilities almost equal.


https://coderanch.com/t/178207/java-Web-Component-OCEJWCD/certification/taglib-directive-tagdir-uri


The tag files *.tag must reside in jar-file/META-INF/tags or subdir of it and
a tld file must exist in jar-file/META-INF or subdir of it with <uri>someURI</uri> tag in it .


Based on the above two posts, b is not valid. We cannot use tagdir="/META-INF/tags" to refer to a tag file in a jar.
+Pie Number of slices to send: Send
I agree with you. Nice explanation!
What kind of corn soldier are you? And don't say "kernel" - that's only for this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1672 times.
Similar Threads
Doubt on taglib?
Tag Files : why TLD requires
What will the "tagdir" attribute be for a tag file inside /META-INF/tags of a jar?
Location of tld files
Tag File Mock Question
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 07:50:49.