About <taglib> element in the web.xml doubt ?

Moderator: admin

Post Reply
gurpreet_asrgndu
Posts: 55
Joined: Thu Jan 03, 2013 7:51 am
Contact:

About <taglib> element in the web.xml doubt ?

Post by gurpreet_asrgndu »

Consider i have a tld file hello.tld with a uri tag in it as <uri>guru</uri>. i put this .tld file in WEB-INF directory. also i put a taglib element in web.xml as follows :

<taglib>
<taglib-uri> test </taglib-uri>
<taglib-location>/WEB-INF/hello.tld</taglib-location>
</taglib>

my question is which mapping will container choose : test -----> /WEB-INF/hello.tld OR

guru---->/WEB-INF/hello.tld OR both will be loaded.

question no. enthuware.jwpv6.2.1053 explanation says that :
Note that the mapping information contained within the tld file will always be loaded by the container. The <taglib> tag in web.xml is used to provide any additional taglib-uri mappings. And for those additional mappings, you will need to specify the taglib-location.

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

Re: About <taglib> element in the web.xml doubt ?

Post by admin »

The URIs are only used to identify which tag library is being used. So you can have mutliple uris pointing to same tag lib.

What you cannot have is same uri pointing to different tag libraries.

Please take a look at Section JSP 3.2 (Taglib Map) and JSP 7.2.3 (Tag Library directive) to understand how this works.

HTH,
Paul

Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests