I have defined two .tld
files under WEB-INF
but both of them has the same <URI>
say "XYZ".
I declared in the JSP <%@ taglib prefix="mine" uri="XYZ" %>"
.
How does container resolve the ambiguity as to which tld
file to read to get the function class and function definition?
EDIT : I ran it in Tomcat 7 and it didn't throw exception.
It'll load the first match found in classpath. The order is JVM and OS dependent (and essentially arbitrary). You don't want to rely on that and you should fix the .tld
URIs.
If this represents a real world problem and the taglib code is outside your control (which is however quite strange, who would ever copy an URI of an existing taglib? do you really own the other taglib's domain?), then you can always redefine taglib URIs in webapp's web.xml
as follows:
<taglib>
<taglib-uri>http://www.example.com/foo</taglib-uri>
<taglib-location>/WEB-INF/foo.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://www.example.com/bar</taglib-uri>
<taglib-location>/WEB-INF/bar.tld</taglib-location>
</taglib>