JSF tld newbie Question  
Author Message
Carlos





PostPosted: 2005-2-11 14:58:00 Top

java-programmer, JSF tld newbie Question Hello all,
I was looking at the JSF implementation source and some sample JSPs
from sun. I was wondering how/where the tld files are referenced/found.

For example the tld file html_basic.tld is jarred in the jsf-impl.jar.
In a jsf page it is imported with <%@ taglib prefix="h"
uri="http://java.sun.com/jsf/html" %>. Now there does not seem to be
any reference to the uri mapping in the web.xml or faces-config.xml or
anywhere else to the above uri.

So how does the application know that uri="http://java.sun.com/jsf/html"
references html_basic.tld?
Thanks

 
Ryan Stewart





PostPosted: 2005-2-11 20:43:00 Top

java-programmer >> JSF tld newbie Question "Carlos" <email***@***.com> wrote in message
news:EHYOd.360597$6l.252321@pd7tw2no...
> Hello all,
> I was looking at the JSF implementation source and some sample JSPs from
> sun. I was wondering how/where the tld files are referenced/found.
>
> For example the tld file html_basic.tld is jarred in the jsf-impl.jar. In a
> jsf page it is imported with <%@ taglib prefix="h"
> uri="http://java.sun.com/jsf/html" %>. Now there does not seem to be any
> reference to the uri mapping in the web.xml or faces-config.xml or anywhere
> else to the above uri.
>
> So how does the application know that uri="http://java.sun.com/jsf/html"
> references html_basic.tld?
> Thanks
>
Section 7.3 of the JSP specification, while somewhat confusing on the first
read, indicates that a TLD placed in the META-INF directory of a JAR file or one
of its subdirectories will be found, and the uri declared in it will be made
available for use. It doesn't quite come out and say it that concisely, but
that's what it comes down to. In other words, your html_basic.tld declares a
<uri> element "http://java.sun.com/jsf/html". Because the TLD file is in the
JAR, presumably somewhere in the META-INF directory, your application can use
that absolute URI.