About Question enthuware.jwpv6.2.1053 :
Posted: Sat Oct 08, 2011 2:47 pm
Explanation is partially wrong:
- is wrong. <taglib> tag should be used inside <jsp-config>.The <taglib> tag comes directly under the web-app element
It is not correct that *.tld files can be located under any sub-directory of WEB-INF. This is quote from specification2. Keep un-jared classes in WEB-INF/classes. You can keep the *.tld under WEB-INF (or in any sub directory under WEB-INF) but you have to specify that in the <taglib-location>. For example, if you put mylib.tld in WEB-INF then you should give: <taglib-location>/WEB-INF/mylib.tld</taglib-location>
If *.tld file is under WEB-INF dir or any of the allowed sub directories then it is not required to specify any <taglib> inside web.xml.JSP.7.3.1 Identifying Tag Library Descriptors
...
TLD files should not be placed in /WEB-INF/classes or /WEB-INF/lib, and must not be placed inside /WEB-INF/tags or a subdirectory of it, unless named implicit.tld and intended to configure an implicit tag library with its JSP version and tlib-version.
JSP.7.3.2 TLD resource path
...
The following order of precedence applies (from highest to lowest) when
building the taglib map (see the following sections for details):
1. If the container is Java EE platform compliant, the Map Entries for the tag libraries
that are part of the Java EE platform. This currently includes the JavaServer
Pages Standard Tag Library libraries and the JavaServer Faces
libraries.
2. Taglib Map in web.xml
3. Implicit Map Entries from TLDs
- TLDs in JAR files in WEB-INF/lib
- TLDs under WEB-INF
4. Implicit Map Entries from the Container
...
JSP.7.3.4 Implicit Map Entries from TLDs
...
The taglib map described in web.xml is extended with new entries extracted
from TLD files in the Web Application. The new entries are computed as follows:
• The container searches for all files with a .tld extension under /WEB-INF or a
subdirectory, and inside JAR files that are in /WEB-INF/lib. When examining a
JAR file, only resources under /META-INF or a subdirectory are considered.
The order in which these files are searched for is implementation-specific and
should not be relied on by web applications.
...