About Question enthuware.jwpv6.2.1053 :

All the posts and topics that contain only an error report will be moved here after the error is corrected. This is to ensure that when users view a question in ETS Viewer, the "Discuss" button will not indicate the presence of a discussion that adds no value to the question.

Moderators: Site Manager, fjwalraven

Post Reply
ETS User

About Question enthuware.jwpv6.2.1053 :

Post by ETS User »

Explanation is partially wrong:
The <taglib> tag comes directly under the web-app element
- is wrong. <taglib> tag should be used inside <jsp-config>.
2. 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>
It is not correct that *.tld files can be located under any sub-directory of WEB-INF. This is quote from specification
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.
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.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.
...

admin
Site Admin
Posts: 10388
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.jwpv6.2.1053 :

Post by admin »

Hi,
1. You are right. The taglib element has been moved under jsp-config in the newer versions of the JSP Specification. This has been updated.

2. You are right that a tld file cannot be placed in WEB-INF/tags.

3. The mapping information contained within the tld file will always be loaded by the container. For that, the taglib tag itself is not required. The <taglib> tag in web.xml is used to explicitly provide any additional taglib-uri mappings, and for those mappings, you will need to specify the taglib-location pointing to the the location of the tld file.


The explanation has now been updated.

thank you for your feedback!

Viva

Re: About Question enthuware.jwpv6.2.1053 :

Post by Viva »

Hi in the explanation it is written:

"2. Keep un-jared classes in WEB-INF/classes. You can keep the *.tld under WEB-INF (or in any subdirectory under WEB-INF except WEB-INF/tags or its subdirectory) 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>"

But isn't it true what the previous user has quoted in his last quote from the spec about if the taglib element? It seems like <taglib> is NOT required actually for this case(as it is not required for the case when the lib is in .jar):

"
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.
...
"

Thanks

ETS User

Re: About Question enthuware.jwpv6.2.1053 :

Post by ETS User »

related to the last post before me..

the explanation of enthuware.jwpv6.2.1197 and more specifically the last sentence

"2. Keep loose (or unbundled) classes in WEB-INF/classes. You can keep the *.tld in WEB-INF (or any sub directory of WEB-INF) where the webapp can access it. In previous versions, you had 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-uri> ) but 3.0 onwards, you don't need to do that."

admin
Site Admin
Posts: 10388
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.jwpv6.2.1053 :

Post by admin »

Yes, it seems the latest version does not require you to specify the location of the tld file anymore. This has now been updated.

Post Reply

Who is online

Users browsing this forum: No registered users and 18 guests